Display a "Waiting for sync . . ." message

AppSheet allows us to combine the computing power of Google Sheets and other spreadsheets with that of AppSheet expressions. While it’s generally better not to rely on computations in Google Sheets because it can cause syncing delays and issues, sometimes letting Google Sheets do some calculations in the background is the best way. For example, in the following post, I explain how to make a mirrored histogram using Google Sheets in a way that I don’t think is possible in AppSheet at this point:

But then there is the issue of those periods of time between user input of data, background calculations in a spreadsheet, and the proper reflection of those calculations in your app. I have found situations in which incorrect numbers are shown until all of the syncing is finished. In some situations the delay before correct data is displayed doesn’t strike me as a big problem but there are other situations where any display of “wrong” information is unacceptable.

My hack to deal with this kind of problem is as follows:

if([Session no copy]<>[Number],“Calculating . . .”,

The [Number] in this case is something that has just been changed by the user. So, AppSheet “knows” the current value. The [Session no copy] is a column that merely reproduces [Number] via the Google spreadsheet. In the spreadsheet, [Number] is J2, and [Session no copy] is “=J2”. The result is that [Session no copy] will not equal [Number] until the sync is complete. In other words, AppSheet won’t “know” what the new value of [Session no copy] is until the sync is complete. Hence, instead of displaying incorrect numbers, my app displays the following:

Then, when the sync is complete, AppSheet sees that [Number] and [Session no copy] have the same value and so it displays that the calculation, which is now correct:

By the way, the bars, numbers and stars representing the amount of work done each day are another example of something I was able to put together on Google sheets but wouldn’t know how to do on AppSheet. Notice that the data for January 18 (1月18日) changes after the sync.

Finally, I’m posting this as a tip but I’d also like to make a request to AppSheet. Could you make some kind of expression that we could use to determine when a sync has been completed so that the kind of hack I have explained here would not be necessary? For example, perhaps it could be a SYNCED() expression that would work as follows:

if(SYNCED([my_column])=true,“Your sync is complete”,“We’re working on it. Please be patient.”)

8 5 1,797
5 REPLIES 5

By the way, here’s another tip I wrote about how to force the immediate calculation of a number by making AppSheet write it to the sheet. The tip about "Waiting for sync . . . " is for situations where my previous strategy doesn’t work:

Congrats @Kirk_Masden, these hacks are really really nice…Domo arrigatogozaimasta

どういたしまして

Hi Kirk, I’ve not understood how to apply your trick.

Hi @Massimo_Pioli !

Perhaps the best way to show how to do it would be to make a simple sample app that I could share. Unfortunately, I don’t think I can take the time to do that now.

Perhaps the following illustration will help. You make the app write something to the sheet but then read the same value from a cell that pulls in that value with something like J2. The app “knows” what it has just written but it won’t “know” the value from the spreadsheet until the sync is complete. If the app doesn’t find J2 and K 2 to be the same, then the sync is not complete and the app says something like “Calculating . . .” When the sync is done, the two will be the same and the correct value can be displayed.

 

 

Top Labels in this Space