cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Switch to a mashup based on time of day

SOLVED
Highlighted
Visitor

Switch to a mashup based on time of day

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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Switch to a mashup based on time of day

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.

 

2020-10-23_11-53-05.png

View solution in original post

8 REPLIES 8
Highlighted

Re: Switch to a mashup based on time of day

You can run a Refresh widget into either a service or expression to then trigger a navigate widget.

Highlighted

Re: Switch to a mashup based on time of day

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

Highlighted

Re: Switch to a mashup based on time of day

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".  

Highlighted

Re: Switch to a mashup based on time of day

Is there a guide on how to trigger navigate from a service or subscription? I've been looking but I can't find one. 

Highlighted

Re: Switch to a mashup based on time of day

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

Highlighted

Re: Switch to a mashup based on time of day

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?

Highlighted

Re: Switch to a mashup based on time of day

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.

Highlighted

Re: Switch to a mashup based on time of day

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.

 

2020-10-23_11-53-05.png

View solution in original post

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!