โHow can I update a parent record when a child record is changed?โ
โHow can I mark all the line items in an invoice as paid when I mark the invoice as paid?โ
โIf I have App Formulas inside a physical column, how can I get those to update like a virtual column?โ
โHow can I recalculate formulas with a push of a button?โ
A way to update app formulas and recalculate values on the fly.
Through the fact that updating any value inside a record in an AppSheet app will cause ALL formulas on that row to recalculate (physical & virtual columns both).
- A hidden column of the number type
- An action to add 1 to the current value of that column
- [Update_Column] + 1
Once you start implementing systems like this, you can easily end up with hundreds of actions that you have to look through to find what youโre trying to fix or work with. The search feature is helpful, but to make things even easier itโs handy to adopt a naming convention.
Once you have this system in place in all the tables in your app (that need updating like this), you can utilize reference actions to update large sets of records all at once.
You can easily update all the child records from a parent-child relationship inside your app
All you have to do is create a reference action that runs the update action over the [Related Child_Records] column.
When youโve got more than one [Related Whatever] column (and associated tables) that you need to update, the process is relatively the same - you just have to add in a composite action into the mix.
Working in the opposite direction from the example above, you can utilize the exact same ref-update system to update a PARENT record from the child.
Setup is almost exactly the same (you can copy the same Ref Update action and just change a few things to speed things up).
If you include an additional column in your tables that will allow you to flag columns in such a way, you can create a slice to pull those records out and a corresponding reference action that runs the update action only on that subset.
This is nice when youโve got records or data that you need to upload into the system (and youโre not wanting to utilize the CSV upload feature);
The true functionality for the AppSheet system is โsupposed toโ update ALL app formulas when you change data from a bot's task - but in practice, more often than not, itโs as I describe above and only the actual [Update] number changes.
I call these bugs "see-saw bugs" - it's prone to โbreakingโ and reverting back to the functionality Iโm describing here; they fix it, but eventually it breaks again. Iโd rather assume itโs broken all the time and this is how things function. Iโm content to work within the constraints of something that will be reliable and constant in itโs behavior, vs building something that MIGHT work or might not.)
Nope, you update the row that has the expression you want recalculated
Apologies, I had it reversed. Yes, you are correct I would manually update a child row in my case, but then I would still need to run an action on the parent row. In this case I would have to either update the column in the parent table via expression run in that action or update another column which would recalculate that row right? There is not an action that would simply just 'save' the parent row?
If you use an extra column on your table to update the row, you could have an App Formula that will get updated when you update the Update column.
If you don't have an Update column, you can use an action to directly update the column but that column can't have an App Formula.
You need two actions.
One in the parent table to do either of the two things I said in the beginning
One in the child table to "Execute an action on a set of rows" where the table is the parent, the action is the one you just created and the rows is the FK from the current row. AppSheet expects a list, so wrap it with LIST()
Of course, none of this is needed if you use a virtual column in the parent table
I've implemented this quick update system, triggered through bots. However, I'm finding that most of my columns with the app formula type (not virtual) are NOT being updated. Even though the [Update_Column] has been updated as has the Change Timestamp column.
Reading through this thread, I found, "Update actions called through a workflow WILL LIKELY NOT update the app formulas for the row". I did not consider bots to be a workflow-- am I wrong? Should my columns with app formulas be updating as well as Update number column?
Anybody else experiencing this?
A workflow is what Bots was called back in the day.
If you want instant change, use actions, which are going to run on the client's side.
I found that using bots works but you need to understand that those changes are not going to be propagated to the client
Thank you. The changes do not need to be instantaneous. Potentially, hundreds of child rows would be affected by the parent action which is why I moved the action into bots.
I have around 5 columns that have an app formula as the content, dependent on each other. It seems like only some of these formulas update when the quick update action is run, while others have the old content.
If the quick update system updates all columns with no issues, I will assume there is a problem somewhere in my formulas or composite actions.
When using AppFormulas, instead of Initial Value, it should always update. Could you confirm it's actually AppFormula?
Finally, you could also try adding the expression right into the action, but that shouldn't be allowed if the column has an AppFormula, but may fit your needs having it in an action instead of the AppFormula section
I can confirm that the columns are of the AppFormula type. I have thought of changing these to text type and inputting the formulas into the initial value, then updating these directly with the action as you suggested. A little more work, but it's absolutely crucial that these update correctly.
Perhaps the order of the columns are important? For columns with the AppFormula type, if Column1 depends on values from Column3, but the action updates Column 1 first.....
Also note, when editing the child directly, all changes are correct.