App Formula Calculations Lagging Row Edits

Apologies if this has been answered before, but I couldn’t find anything with the search.

I’m encountering a strange behaviour in my app. It took me a while to figure out what is actually happening, and it was driving me crazy!

For context, my application captures progress of activities. One row per activity with a whole bunch of columns to define what the activity is, target dates, achieved milestones, etc, etc… I am using Quickchart.io to generate a stacked bar chart, showing the status of activities by target date (I don’t think this is achievable with the built in AppSheet chart builder?);

For this I only need to generate the column labels and values for each series. That’s all fine!

On top of this I’m allowing users to filter the data they want visualised in the chart, based on a number of the columns in the dataset. I’ve created a separate table to capture user’s filter selections (one row per user) and I have a slice (per series - G1, G2…) that is applying these to the main data set. That’s also all fine!

I’m then using a (probably pretty messy, inefficient) app formula to count the number of entries of each slice per year-quarter to get a string to feed to quickcharts (e.g the below formula returns “1,6,1,12,1,” as shown in the above chart);

What is infuriating me is that when I am calculating the chart inputs they always seem to lag behind the selections that have been made in the filters. When first loading the app, with no filters selected, the chart displays as expected. Then, when setting a filter value the chart values don’t update. When setting another filter value the values then update - to show the chart that should have shown previously!

So, that app formula for the chart URL appears to be calculating on row edit but for the previous values, not the ones that have triggered the update?

For now I’ve implemented a Yes/No field in the filter table. This gives me a toggle that can force the chart to update, but that’s obviously not an ideal solution!

Am I missing something obvious here? Or am I going about this in fundamentally the wrong way. Very much still learning my way around AppSheet, so greatly appreciate any support from the community.

When a virtual column in one table is making calculations based on records in a 2nd table (assuming that describes your situation), it requires a full sync, after the changes are made in that 2nd table, before the VC value is updated. Are you waiting for this full sync to finish before expecting the chart to be updated? And are you just coincidentally making your 2nd update just as the 1st update has finished syncing?

1 Like

I assume waiting for the little counter to disappear constitutes a full sync?

Josh_B_0-1682582407731.png

The formula I shared above is in a ‘real’ column. Looking in the spreadsheet I can see the filter options being populated, but the calculated value from that formula definitely doesn’t update until another change is made to the row.

There are probably virtual columns somewhere along the calculation chain. If I want speedy updates of these values should I be aiming to fully utilise one type of column or the other?

)

waiting for the little counter to disappear constitutes a full sync?

Yes. And sometimes even a couple seconds after the number disappears for the values to visually update.

If your formula is in a real column, then you must be editing that same record? Otherwise it wouldn’t update at all. I’m a bit confused on your setup, can you provide more detail?