Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello,
I'm wondering if it is possible to switch to a mashup based on the time of day. My goal is to having something such as at 2:50 pm every day, the screen will switch to a mash up that says to start winding down and prepare for the shift change. Or at 7:00 am - 7:10 am every morning, the screen will ask the operators to check their equipment. Is this possible?
Thanks
Solved! Go to Solution.
As @PaiChung said, you'll need a validator that checks the current time. Here's a demo of that:
1. Create a validator with the following code (I use the en-GB language because it will be in 24 hour format instead of 12 hour and won't include the AM/PM stuff at the end):
Output = (new Date().toLocaleTimeString('en-GB', {hour: '2-digit', minute: '2-digit'})) === "07:00"
or
Output = (new Date().toLocaleTimeString('en-GB', {hour: '2-digit', minute: '2-digit'})) === "07:10"
2. Put a refresh widget on the screen and set the Refresh Interval to 60. Connect the Refresh trigger to the Execute of the validator.
3. Create a Navigate action to go to the next mashup.
4. Connect the True trigger of the validator to the Navigate action.
5. Repeat on the secondary mashup to go back to the original one.
6. Be sure to test this on the target browser... I've heard that toLocaleTimeString may act differently on different browsers.
You can run a Refresh widget into either a service or expression to then trigger a navigate widget.
Hello,
Thanks for your response. How do I trigger the navigate function with a service? I thought I could make a scheduler, and then drag "scheduled event" onto the navigate function, but "scheduled event" does not show up when you add the scheduler to the data section of the mashup builder.
Thanks
it may be easier to use the tabs widget with each mashup on a different tab.
You can then use a refresh widget to periodically run a service. The output of that service would bind to "selectedTabName".
Is there a guide on how to trigger navigate from a service or subscription? I've been looking but I can't find one.
Use the Navigate widget/function, it has 'Navigate' available as a service that can be triggered.
As I think about what you are looking to do, you will probably need a Validate widget/function to provide the trigger on true/false
I see the where to bind to navigate. I've used this to switch between mashups one after another in a loop every 15 seconds using the auto refresher, but I'm lost on how to get this to trigger based on the time of day. How would I configure the validate function to do this?
Like I said you may need a service or expression function.
You can do every minute timer - trigger expression or service - verify time of day vs. schedule - return true/false into validator which on true triggers navigation.
As @PaiChung said, you'll need a validator that checks the current time. Here's a demo of that:
1. Create a validator with the following code (I use the en-GB language because it will be in 24 hour format instead of 12 hour and won't include the AM/PM stuff at the end):
Output = (new Date().toLocaleTimeString('en-GB', {hour: '2-digit', minute: '2-digit'})) === "07:00"
or
Output = (new Date().toLocaleTimeString('en-GB', {hour: '2-digit', minute: '2-digit'})) === "07:10"
2. Put a refresh widget on the screen and set the Refresh Interval to 60. Connect the Refresh trigger to the Execute of the validator.
3. Create a Navigate action to go to the next mashup.
4. Connect the True trigger of the validator to the Navigate action.
5. Repeat on the secondary mashup to go back to the original one.
6. Be sure to test this on the target browser... I've heard that toLocaleTimeString may act differently on different browsers.