Perspective Alarm Popup

How would you create the alarm banner popup in perspective like the one in vision? I want the alarm page to popup when there is a new alarm.

Do you want this Popup to open for any page you have open, or only on a specific page? Could you please clarify what you expect this Popup to look like (I’m not familiar with the “alarm banner popup”).

I believe one solution that you could try involves one tag and adding a binded value to each root. You create a memory tag to store the previous number of alarms. On each root you add a value binded to [System]Gateway/Alarming/Active and Unacked with a script transform. On this transform you check if the new value is greater than the previous alarms tag and if so do a system command for a popup or navigation. Just remember to update the alarms count tag before the script ends. It might not be the best but it should work.

I want it to pop up on any screen. This application only has three pages, but I may want to use this in the future on projects with more pages. The other way may be to do this like the alarm notification in Vision from the old demo project. There is an indicator that tells the number of new alarms and it turns red when there is a new alarm. In vision it’s done with the alarming system tags.

Okay, this is my solution, and it involves three important parts:

  1. A Gateway timer script to periodically update the count of active and un-acknowledged alarms.
  2. A Session-scoped Message Handler.
  3. A Session custom property with a change script.

Gateway Timer script:

activeUnacked = system.alarm.queryStatus(state=['ActiveUnacked'])
# modify "QACody" within this script to match your project name
for sessionObj in system.perspective.getSessionInfo(projectFilter="QACody"):
    # this check is to avoid Designer sessions which can cause failures because they do not use a UUID
	if len(sessionObj['id']) > 8:
        # ALARMCOUNT is the name of the Message Handler we will use in the session-scoped listener
		system.util.sendMessage('QACody', 'ALARMCOUNT', payload={'activeUnacked': len(activeUnacked)}, scope='S', clientSessionId=sessionObj['id'])

Session-scoped Message Handler (Project > Session Events > Message in the Designer menu bar):

# activeUnacked is a custom session property I have created in my project
session.custom.activeUnacked = payload['activeUnacked']

Session custom property Change Script:

	if previousValue is None or currentValue.value > previousValue.value:
        # note that you will once again need to update the project name
		for sessionObj in system.perspective.getSessionInfo(projectFilter="QACody"):
			if sessionObj['id'] ==
				for pageId in sessionObj['pageIds']:
                    # "AlarmPopup' is just a unique identifier for the Popup.
                    # You will need to update the view argument to match the path to the Popup YOU design to suit your needs
                    # The title argument is displayed as the title of the Popup
					system.perspective.openPopup('AlarmPopup', view='Popup', title='New Alarm', pageId=pageId)

This is configured to open a popup for a page if the new count of alarms is greater than the old count, and so if multiple alarms have become active you will still only get one Popup. It will open for ALL open pages in ANY active session (outside the Designer) for the project you specify/configure. The design of the view you supply for the Popup is entirely up to you, but I recommend something with an Alarm Status Table.

1 Like