Hey folks! Quick logic question: I need a popup to trigger whenever a specific tag (memory tag) goes high. The catch is it needs to show up on every page (whichever one is currently open).
Does anyone have a recommendation for handling global triggers like this without duplicating the logic on every single screen? Thanks in advance!
Use a global docked view, and bind the tag to a view custom property within it. Add a change script to that prop that opens the popup.
2 Likes
Hi,
Thanks for the reply!
Can you please attach any reference scripts available ?
Hi,
I went through a few posts posted in this forum for similar topic.
And i have come across this code
popupId = "pop1"
viewPath = "Nav Link" # insert your view path here
logger = system.util.getLogger("POPUP")
sessions = system.perspective.getSessionInfo()
for session in sessions:
for pageId in session.pageIds:
logger.info("{0} | {1}".format(session.id, pageId))
if currentValue and currentValue.value: # I added an additional safety check for first time use here
system.perspective.openPopup(popupId, viewPath, sessionId=session.id, pageId=pageId)
logger.info("openPopup complete")
else:
# note no viewPath arg
system.perspective.closePopup(popupId, sessionId=session.id, pageId=pageId)
the pop up is not displayed in the page and got this error in the log
The whole point of my advice to use a dock was to avoid having to loop through session information. The change event on the docked view's custom property can be a simple one-line call to system.perspective.openPopup(). Perhaps another line to make it conditional.
1 Like