Issues with sync vs browser refresh

Hello,

We have an AppSheet app of low/medium complexity using a Google Sheets backend, and I’ve been setting up some report generation buttons using the pattern I’ve seen recommended:

  1. Hidden column in table (e.g. “Action”) holds a placeholder string, e.g. “idle”
  2. Action triggered from button click changes the column value to e.g. “run_report”
  3. Automation detects change, resets column to idle value, and generates report

So far, this is working the first time the button is clicked for a row. I can see the “Action” column value change, the report is generated, and the value in the backend table is reset. However, the value in the web client is not being reset, even after manual sync (column is temporarily visible so I can monitor this). The issue with this is that, if the button is clicked again for that same column, the automation is not triggered (I assume because it is not seen as a field change). I have confirmed this using the automation monitoring page for the app.

However, if I refresh the browser page itself, everything appears to update, the correct (“idle”) value is shown in the table, and clicking the action button triggers the automation again. I have tried this in both Firefox and Chrome, as well as a Firefox private window, and the behavior is the same in all. I have also tried turning on/off “Delayed Sync” and “Automatic Updates” in the app settings, in all possible combinations, and this has no effects, nor does a manual sync. Only refreshing the browser page forces an actual update.

Has anyone else observed this behavior? Does anyone have any ideas on a solution or workaround (other than the obvious – telling users to refresh the browser after they generate a report)? Thanks in advance for any help.

It’s better to use DateTime column for this purpose. Create an action that writes it with NOW(). Then you don’t need to reset anything

3 Likes

Hi 371dd89e9d291818b77d,

As AleksiAlkio mentioned, you can set the action to write to that column using NOW() and then configure the Bot to run when that column is updated.

Another option is to set the column as a Number and have the action increment it by 1, for example:
[run_report] + 1

With the first option (DateTime), you can track exactly when the user last pressed the button and when the report was generated.

With the second option (Number), you can track how many times the user regenerated the report. This also allows you to store different versions of the report if needed, such as Report_v1, Report_v2, and so on.

Or you can have both by adding one more column, if you really need it.

1 Like

One side effect with the number.. it’s possible that two users trigger the action from a stale data and therefor it’s not sequential.

2 Likes

Many thanks AleksiAlkio and QREW_Apps for providing guidance. Regardless of why the observed refresh behavior happens, I see that writing a unique value each time would avoid the problem altogether. I will take this approach.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.