Is it possible to automatically switch views ...

ux
(Brady Lovell) #1

Is it possible to automatically switch views based on the time of day?

For example, I have a Dashboard view made up of several ‘Ref’ views. One of the ‘Ref’ views is for the current days’ orders, labeled “Today’s Orders”. This view basically becomes obsolete after lunch, as we switch gears to a view called “Tomorrow’s Orders”.

Is there anyway to apply some sort of Show_If formula, or maybe another method so that “Tomorrow’s Orders” shows up between noon to midnight, and “Today’s Orders” show up between midnight to noon?

(Praveen Seshadri (AppSheet)) #2

The common way to do this would be to keep the view the same (let’s say it is called “Current Orders”) but to switch the data shown in the view via a slice definition.

In a few rare cases, you might actually want to show a fundamentally different view depending on a logical condition. In that case, use the Show_If condition in the view definition to show or hide the view button

(Brady Lovell) #3

Yes I want to keep the view the same, but just switch out the first ‘Ref’ view (“agendaTodaysOrders”) to the alternative ‘Ref’ view(“agendaTomorrowsOrders”), automatically on a daily basis. Is there a way to do this without having to go into the app editor and change the slice in the View entries manually?

(Aleksi Alkio) #4

Then you would need to create two separate Dashboard view with the same display name value and add a suitable expression for condition checking.

(Brady Lovell) #5

@Aleksi_Alkio

Let me see if i’m understanding correctly. I create 2 dashboard views, one called “today” and one called “tomorrow” and put the text

“currentOrders” as the display name for each view.

Then I create a Show_If expression to show “today” between the hours of “00:01 - 14:00” and another Show_If expression for “tomorrow” for the hours of “14:01 - 00:00”?

If that’s the case, then I just need to figure out how to create the expression, which at this point I don’t know how to do but will start researching it. Just want to make sure I’m on the right track.

Thanks

(Aleksi Alkio) #6

Correct and the formula could be… AND(TIMENOW()>“00:00:00”,TIMENOW()<“14:00:00”)

(Brady Lovell) #7

@Aleksi_Alkio Once again, you have helped me out tremendously. Works exactly how I had envisioned it. Can’t thank you enough!