HOW TO UPDATE RECORDS BETWEEN CARDS MORE QUICKLY

Hi,

I am trying to create an App to assign coworking rooms to a group. The group can be distributed in multiple rooms, according to the available type of room requested and its capacity.

So, in an individual room, only one person can occupy the room and there are only five of them.

I am using card view to show the different room types available. Each card shows the current availability assigned, the rooms still available and a message summarizing the number of people already assigned and those that have not been assigned yet. This text is the problem since it is common to the 5 cards (5 room types) and the totals showed do not update contemporary on all of them, making the user experience confusing. So if I add a room, all the calculations on the same card are correct but in the other 4 cards numbers don't change until the auto-update is done. Also if I add or remove a room in another card, the totals from the other card are used but not synchronized in the other cards.

Sync on each add or remove is not an option (it would work though) since it takes more than 10 seconds each time.

you can see a video here

https://www.loom.com/embed/d4d0ca654e8b4d7ba7477b6a0558db10

I use virtual columns to make these calculations

I have 3 main tables:

1. Areas: is where the description and total capacity of each room is defined. I use this table for the card view and for the virtual columns.

franc_1-1657020447421.png

2. Occupancy log: to record each add/remove (+1 or -1) associated with each 

franc_2-1657020629804.png

and a table "Lead" to create a form to collect the group data (n. of persons, date in and out, email...)

I have tried many ways to accelerate this calculation but I haven't found a way that really works. It looks like even if the virtual colomns are the same for these cards, it is not possible to update the other cards on the fly. I am pretty desperate at this time.

If anyone from AppSheet wants to check it is appName=ask_12_Copiade9-3831128.

I haven't published this app yet.

Any idea of how I could improve this?

Thank you

Franc

Solved Solved
0 9 243
1 ACCEPTED SOLUTION

When you first posted I did try the video link and couldn't open it.  Maybe it was too soon or there was some other issue.  I tried to answer anyway. 

I went back to that post and was able to watch the video.  I see now that you are relying on buttons only to Add and remove the rooms.  I had assumed you were using the Form.

So, just a slight modification.  Instead of using the Form Saved behavior,  you would simply need to add the "Update just_1" action to your already existing "Add Room" and "Remove Room" actions.  If these actions are already Group actions, then just insert this new action at the end.

If not, then you will need to add a Group action for each, maybe name them "Add Room Group" and "Remove Room Group", then add your existing actions to each appropriate Group and insert the new action into both.  Note that your Group actions will now become the buttons so you will need to "Move" any button criteria from the existing actions to these Group actions.  You can use the Display Name properly to make sure the new button actions still show the expected name in the view - e.g. "Add Room" instead of "Add Room Group"

View solution in original post

9 REPLIES 9

There isn't any built-in functionality to force those other rows to update so the results are immediately seen in the UI.  You will need to build it.

You simply need to make a row edit on those other rows to trigger the App Formulas.   The idea is that when a user makes a row change/edit, you can attach an action (or action Group) on the Save to identify other rows to be updated and apply an edit.  If there isn't an obvious edit to make, I will introduce an EditCount column and simply bump the count by 1.  Doing so causes a row edit to occur and forces all of the row's App Formulas to fire. 

If there some columns that are updated by an expression not in an App Formula, you can simply re-apply the expression.

Thank you very much @WillowMobileSys for your kind reply. I'll try it out. I have some doubts about how to do it but I'll first try and eventually ask you for some clarification if I get stuck.

Again, thanks a million for your help. 

Franc

Hi @WillowMobileSys 

I have tried to apply your suggestions but probably I am not getting what you meant, and I have tried many different ways. So, I probably explained poorly my problem, or I didn't get your explanation right.

Let me try again: the view is a card view and the rows that don't update are actually the same that do update in the first card but not in the other cards at the same time, they update once the auto-update is completed (quite a number of seconds to do so). So I just want the same values to be replicated in real-time in the different cards on the same view. These values are virtual columns so I don't really see rows to edit. In fact, in the 1. Areas table (in the picture above) no rows are ever added, in this excel sheet there are only static values, and all the computation on the remaining capacity of each room is calculated through these virtual columns.

Thanks in advance for all your kind help

Franc

 

I believe I do understand your problem.   Whether you actually see the rows or not is not important.  That fact is that each of those static rows have Virtual Columns (VC's) that you want updated immediately when some other row add or edit is made.   The only to make that happen is to force an edit on those rows - even if it's just bumping a column count.  Any edit on a row will cause all of that rows App Formulas to fire - including VC's App Formulas and you'll see the results immediately on that device.

Let me paraphrase and explain further.

In a Card View, each card represents a single row from the table.   When you edit a Card/row, you want some other set of rows (visible or not) to be updated as well - i.e. you want the Virtual columns (VC's) in those other rows to be executed and perform any needed updates.

Explanation...

You already know, normally, when you edit a single row and Save, all App Formulas of THAT row are fired and perform any updates resulting from those expressions - that includes VC's.  You will these updates immediately in the user UI.  BUT, no other row is yet implacted.  Only until a Sync is performed will those other rows' VC's be executed.  And as you have pointed out, that can take several seconds to minutes.

In order to see the updates to all OTHER rows in the user's view immediately, i.e. not wait on a Sync to occur, the app MUST edit those other rows as well as part of your original row edit.  This will force those other rows' App Formulas, including VC's, to fire and update on the UI side and will show in THAT users UI immediately.  

How to update those OTHER rows

You will need to create an action (possibly a Group of actions) and attach it the Form using the "Form Saved" behavior where the original row edit is being made .  This allows you perform additional edits on ANY other rows in your app.    Here are the general steps:

1)  If you do not have some column on these additional rows that can be updated,  then add one such as an Edit Date or Edit Count column.  Simply changing this one column on those rows will fire ALL App Formulas.

2)  Create an action that modifies that column from 1) - it may only need to update that single target column.

3)  Create an action of type "Data: execute an action on a set of rows" :

  • set its Table to that of the original row being edited
  • set "Referenced Table" to the table where the additional rows to be updated reside - could be same table or a different table.
  • set "Referenced Rows" to an expression that will select ALL of the additional rows you want to update/execute their VC's - must return row ID's for the table in "Referenced Table".
  • set "Referenced Action" to that you created in 2)

4)  If there are any other edits/updates needed, create and add them.  This will require an action of type "Grouped: execute a sequence of actions"  to combine all actions together and execute as one list.

5)  Attach the resulting action to the Form Saved behavior property.

Now, when your row edit is made, the action will fire, performing additional edits to all the other rows identified in the set of actions.  The results updates to all of these rows will be shown in the users UI immediately!

This is a lot to take in, so ask if anything is not making sense!

thanks a  million again @WillowMobileSys 

so I followed your instructions but there is a problem, the view card I am using is based on a slice table. It is not a form. I think that in point 5 you mean to add an event action but there isn't any

franc_0-1657557006681.png

also for point 1 I have created 2 additional columns in Areas table:

1: number column, where I add numbers

2: an change edit to save the time (just in case). they do update but the problem is still there

franc_1-1657557165946.png

I have also created an action to "add 1"

franc_2-1657557280188.png

and the referenced action

franc_3-1657557351264.png

so if this is correct, only point 5 is missing. The actions work with some delay, just like the cards.

What am I doing wrong?

thanks a million

 

 

When you first posted I did try the video link and couldn't open it.  Maybe it was too soon or there was some other issue.  I tried to answer anyway. 

I went back to that post and was able to watch the video.  I see now that you are relying on buttons only to Add and remove the rooms.  I had assumed you were using the Form.

So, just a slight modification.  Instead of using the Form Saved behavior,  you would simply need to add the "Update just_1" action to your already existing "Add Room" and "Remove Room" actions.  If these actions are already Group actions, then just insert this new action at the end.

If not, then you will need to add a Group action for each, maybe name them "Add Room Group" and "Remove Room Group", then add your existing actions to each appropriate Group and insert the new action into both.  Note that your Group actions will now become the buttons so you will need to "Move" any button criteria from the existing actions to these Group actions.  You can use the Display Name properly to make sure the new button actions still show the expected name in the view - e.g. "Add Room" instead of "Add Room Group"

thanks for the update 

Actually, I forgot to mention that I did that too before but it doesn`t work...

franc_0-1657561312618.png

unless there is something missing

thanks a million

F.

 

In what way doesn't it work?

IT WORKS!!!

THANKS A MILLION!

I realized that there was a mistake in the formula here, it missed the self-reference. Now it's working like a charm.

franc_0-1657567072375.png

Thank you so much, you have made my day!!! 

Top Labels in this Space