ONLINE() expression to detect if the user is connected

ONLINE() expression to detect if the user is offline or online.

For me, the main use would be for Usersettings. AppSheet makes very clear that the user must be online to make changes on Usersettings, but have no barriers for that - the user can change it anyway.

I have some apps with Security Filters based on Usersettings data. If you’re offline, you can make changes, the app doesn’t load the correct data (of course, since you’re offline), but the USERSETTINGS() fields are updated anyway.

This results in many entry mistakes that I think we could avoid simply by making these fields editable only if online.

Note: This is a Feature Request, but also a question if someone have any ideas of how to overcome this problem.

Status Open
6 7 708
7 Comments
MultiTech
Gold 4
Gold 4

Hey @hcquadros

You might check out this post:

If you were to implement a user table, and store your global variables there, then the whole offline-online thing doesn’t really matter anymore - everything is stored locally on the device and works “internally” (if you will).

hcquadros
New Member

I use this on some apps (exactly using your Tips & Tricks post as reference - thank you by the way), but on other apps, its a matter of scalling.

For apps that use a lot of data, I need Security Filters or it becomes unusable. The user must load one set of data at a time (for exemple, in a inspection app, load and store all the inspection history for an specific client - he cannot load the inspection history for every client at once).

In these cases, I cannot store everything locally in order to fully work offline*

*Just to clarify, I’m not requesting a new offline approach by Appsheet. I just want to limit what the user can and cannot do while offline - thus an ONLINE() expression.

MultiTech
Gold 4
Gold 4

For apps that use a lot of data, I need Security Filters or it becomes unusable

Did you know that you can use a Current_User (slice) in your security filters???


But I get what you’re saying; I can see a few uses for something like this that could be handy.

Status changed to: Open
Pratyusha
Community Manager
Community Manager
 
Collectiumbro
Bronze 5
Bronze 5

Nice, Do you have more details around setup? Can i use this as App formula = Online()

Joaquin_Otero1
Bronze 3
Bronze 3

Hi, I need to know if the user is online to be sure the data they are viewing is up to date.

The real case is the following:
The app is set to start even offline.
Sales staff must check product prices, which vary quite frequently.
I need to make sure the prices they see in the app are up to date. It may happen that if they do not have an Internet connection they are seeing old prices because the application did not synchronize and was started offline.

So the ONLINE() expression would solve this.
Can you think of another idea knowing that the ONLINE() expression is not available?

Joaquin_Otero1
Bronze 3
Bronze 3

Hi, I have created something similar to what I was looking for, at least it gets the job done.
It is a virtual column with the formula TODAY(). When you open the app and are connected to the internet, that date immediately changes to the current date (also create a format rule so that it turns green and a tick appears if the date in the virtual column matches TODAY()).
If, on the other hand, you open the app without an internet connection, then the last date on which the app was last opened remains (the format rule puts a cross and paints the date red since it does not coincide with TODAY()).
I also show a sign that tells the user that they are offline. All this is done without the need to activate sync on start, which displays a sign indicating that there is no connection, but which is annoying for users who use it offline in places where there is no cell signal.

Joaquin_Otero1_0-1708518332538.png