I recently built an app that is basically a kiosk and is always open. We operate 24/7, so my users submit data throughout the day. My issue is when the date rolls over, the default for a date picker field does not change.
Some details on the app:
I have two instance of the app running at once. One is always set to the entry screen to enter data, and the other monitor displays a gallery with all the items. This is to say that the entry screen is almost always open and isn't generally used to navigate/view items.
The entry screen uses a form control to collect data, including a date. The default for the date is set with the following code:
If(FormNewCallEntry.Mode = FormMode.New,
If(Hour(Now()) >= 6,
Today(),
Today() - 1),
Parent.Default
)
The time offset is to account for shift change which happens at 6 AM.
When a user hits a save button, it calls SubmitForm and the form OnSuccess calls the ResetFrom action.
The Problem:
If you open the app fresh, this all works great and the defaults fill in properly. However, if you have the app open before 6 AM and create a new form after 6 AM, the date default doesn't change and still shows the previous day. You can navigate between screens and call NewForm all you want, but the previous day still populates. This ends up causing problems for my users when they don't notice and enter data with the wrong date.
The only way I found to fix this (without completely reloading the app) is to open a different record with the form in edit mode. Once you do this, calling a new form now loads the correct defaults. I could try to do some sort of refresh that does this set of actions via code triggered by a timer, but it seems like a kluge.
Does anyone have a better way, or even better, a fix to the underlying problem?