Hello everyone, I need some help with a feature I am trying to develop for one of my current projects. I created a perspective view that I would like for it to appear every 10 minutes as a popup in another view. I know how to create the popups but I have not found a way to make de 10 minutes feature to work. Any ideas?
Not enough information.
- How will the popup be cleared?
- What happens if it isn't cleared?
- When does the 10 minute delay start? From previous event? From most recent acknowledge?
- What's going to happen if the user is on another view?
@Transistor brings up a good point but for the sake of giving an answer, here would be my approach:
- Create a custom property on the root container of the view where the popup should open and name it "timer"
- Bind said property to an expression using the
now()
expression function passing in the number of miliseconds, in this case 10 minutes is 600000 miliseconds - Add a script transform to said binding where you call the
system.perspective.openPopup()
scripting function to open your desired popup
This is just a general approach that may or may not work for your needs, as Transistor said, we would need more information to help more.
Thank you both @MSviga I think this gives me an idea as how I can make it happen. Thank you @Transistor for asking those questions because there were things that I did not think about:
- How will the popup be cleared? --> it should be cleare automatically after 2 minutes
- What happens if it isn't cleared? --> It will hide information from the view but is not going to affect nothing critical
- When does the 10 minute delay start? From previous event? From most recent acknowledge? It should count since the first moment the timer starts running
- What's going to happen if the user is on another view? If the user is at another view. It should not be displayed. Only if it is as the specific view
When does it start running ? Is the timing the same for every user, or do they each have a separate one based on when they accessed the view/page ?
It could be either way, whatever is simpler
Then I'd probably send a message from a gateway timer event, catch it in the view that should be displaying the popup, and open the popup from the message handler.
That seems to me like the most straightforward way. No hidden pieces to the puzzle means easy maintenance.
Thank you!! I am trying to get that working. I created a message handler at the root container in the view that I would like to use, that message handler calls directly to the function system.perspective.openPopup and I try calling the message handler from the gateway timer event using the function system.util.sendMessage with no luck. As a context I have never used message handlers and I am no quite sure still how to use them
Yeah that will not work. system.util.sendMessage
invokes a message handler in the session events. To invoke a message handler on a perspective component (in your case on root), you need to use system.perspective.sendMessage
.
You can also chain these two if thats what you need. For example in your session message handler you just call the perspective message handler.
Edit: If using this approach make sure to set the perspective message handler to listen to session scope calls.
Hopefully that makes sense.
I think it does, I cannot call directly from a Gateway timer event to system.perspective.sendMessage right? So I should call first a session message handler and then I can call my root message handler. Does it make sense? I am really struggling with this one
You can, but then you must session or page scope, and provide the IDs needed to target the particular session/page.