Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Hi.
I currently have set up a Navigation widget, so that once it's clicked, a popup mashup appears. I'm interested to have this popup display automatically between certain times of the day. How can I achieve this?
I was thinking of creating a service that checks whether the current time is within the time interval in which the popup should be displayed. But I can't bind the Service Invoke Completed event to the navigation event of the widget, because it would always display the popup when the service would run.
I was thinking into exploring custom events, but I don't understand why an event needs a Data Shape assigned to it. My second question is whether customn events can help me here, because I think I can create a custom event (why assign a data shape to it, though?) and call the custom event through the if-else loop that checks whether the current time is within the time interval that the popup should be displayed. But if I do that, there's no way I can bind any event to the navigation event. So I don't understand how I can use them to my advantage.
If anyone could help me, I'd appreciate it.
Solved! Go to Solution.
Hi Sharon.
Thank you for your suggestion! In the end, I managed to solve this. I created a service that compares the current datetime to the datetime the popup is supposed to appear at. If it's after the datetime, the popup shows, if not, it doesn't. I bound an autorefresh widget to run this service every 60 seconds. Then the service result (true/false) is bound to a Validator expression that returns true if input is true and false otherwise. The All Data Changed of the service is bound to the Validator execution, and the Validator True event is bound to the navigation event of the navigation widget.
Hi @Radu.
In regard to your Data Shape question, the premise behind this is to capture the details around the trigger for the event once it fires. This will allow for troubleshooting, etc., if needed.
For scheduling a popup at a specific time, have you looked at using a scheduler as an alternative to the way you were suggesting?
Regards.
--Sharon
Hi Sharon.
Thank you for your suggestion! In the end, I managed to solve this. I created a service that compares the current datetime to the datetime the popup is supposed to appear at. If it's after the datetime, the popup shows, if not, it doesn't. I bound an autorefresh widget to run this service every 60 seconds. Then the service result (true/false) is bound to a Validator expression that returns true if input is true and false otherwise. The All Data Changed of the service is bound to the Validator execution, and the Validator True event is bound to the navigation event of the navigation widget.