I use a timesheet table with a field called TimeStamp set to default to NOW() with a Show of false. This week I noticed that one of the employees looked like he entered his day sheet the day before the day he worked but when I looked through the Version history on the GSheet, it is clear that he entered it on the correct date but the TimeStamp was incorrect. What could cause this behaviour? How reliable is NOW()?
As per my understanding, the NOW() from AppSheet is reliable. Typically, the NOW() uses the device date time. So if the user’s device is set at a day before at whatever time, I believe it will use that device’s timestamp as NOW(). You can test it by setting your device’s timestamp to a previous day ( or any other day than correct day) and also some other time than the correct time.
I believe you can circumvent that issue by using a workflow ( or now automation) to capture the server time. The workflow can trigger on Adds only and it can call an action to set the timestamp field to NOW().
Thanks Suvrutt. Not sure how to capture the server time. The way I have set this up is that Timestamp is set to NOW() as the initial value. How would I go about capturing the server time instead of the device time?
The employee this happened with is far from tech savvy and it’s the first time I;ve seen the issue. I can only assume he hasn’t set his phone to auto update the time. The problem is that we pay a bonus if they get their timesheets in on the same day they worked so I need to be robust.
This approach to capture the server time was suggested by @Steve in the thread mentioned below. To capture server time, please use following approach. However please be aware that for this approach, the app needs to be online.
- Create an action that sets the timestamp column to NOW()
- Call this action in a data change workflow. The workflow update event will be “Adds Only”
There had been a very substantial discussion on a relevant topic sometime ago, please take a look at it.
Thanks Suvrutt, Appreciate your guidance, yet again. I will likely add a column for local add time and another for sync time to see how often, and how long, there’s a descrepancy for.