Do formulas execute only on Sync or Form edits?

(Rpd Mobile Apps) #1

I have this virtual column (text type) included in the table that gets the type of view I am currently browsing, with the formula of CONTEXT(“ViewType”). Whenever I navigate to Detail type of view, the virtual column returns EMPTY. I tried to add another virtual column using CONTEXT(“View”) and they output the same. Do formulas execute only during sync or editing in a form?

(Praveen Seshadri (AppSheet)) #2

Yes, virtual columns are computed in our backend during sync. This is done for efficiency — you do not want to be using mobile CPU resources (and battery) on recomputing formulas unless you have to.

As a result though, the virtual columns are not continuously recomputed. In this sense, they are different from spreadsheet formulas. In the app itself, they only get recomputed if we are sure they need to be — so in a form or when there are obvious dependencies. However subtle dependencies do not lead to recomputation. For example, if you change a value of a row via a form, a VC in another table that does a SUM over the first table doesn’t get recomputed immediately. It will only be recomputed on a sync.

(Rpd Mobile Apps) #3

Thanks @praveen

Does Appsheet have some sort of tracking formula to which row was previously selected/browsed? I have this action that sets the value of a column of another table using the data of the currently selected row (Detail view), using an action that “executes an action on a set of row” (appearing from current table) and an action that “sets the value of a column” (writes on the other table). It would be easy if there is some sort of a lookup variable where I can set the latter action’s value with PREVIOUSLY SELECTED TABLE’S COLUMN VALUE.