isAlarmActiveFiltered throws REFERENCE_NOT_FOUND when alarms not enabled


I’m trying to implement a client-configurable alarming system within Ignition 7.9.10.
I have configurable setpoints and ‘enable’ tags that the alarmed tag references in its configuration.
I also have some expression tags that attempt to summarize the current alarm information for a given tag.

The issue I’ve found is that the isAlarmsActiveFiltered expression throws a REFERENCE_NOT_FOUND exception if there are no alarms enabled on the given tag. I can see why this would be the default behavior, however, wrapping the expression in a try block doesn’t seem to catch this exception.


		'[default]pathTo/AlarmedTag',	// tagPath
		'*',		// alarmName
		'*',		// displayPath
		0,		// minPriority
		4,		// maxPriority
		False,	// allowCleared
		True,	// allowAcked
		True	// allowShelved

Even with the AlarmedTag having no currently enabled alarms, I would expect this to return 0, or False, on this Boolean expression tag. But:

Haven’t come up with any decent workarounds for this…

Don’t want to use runScript within an expression for this due to performance issues with this volume of tags. Initially these expressions all lived in GUI components, and enabling the overlay opt-out prevented the exceptions from being visible. I could just treat a bad quality as ‘False’, but that wouldn’t be good practice.

Unfortunately it seems like either the try expression or isAlarmsActiveFiltered is not functioning as intended. IA?

I ran into this problem as well. From what I can tell, the REFERENCE_NOT_FOUND error is thrown when there are no alarms configured in the filtered path that meet all the priorities the expression is looking for. For example, in my expression, I’m checking for the highest priority alarm active in a folder path specified by the UDT parameter {RootPath}:

if(isAlarmActiveFiltered("[default]{RootPath}*", "*", "*", 4, 4, 0, 1, 0), 4, 
if(isAlarmActiveFiltered("[default]{RootPath}*", "*", "*", 3, 3, 0, 1, 0), 3, 
if(isAlarmActiveFiltered("[default]{RootPath}*", "*", "*", 2, 2, 0, 1, 0), 2, 1))), 0)

If a priority 4 alarm is configured and active, the expression appears to work fine. However, if no priority 4 alarm exists, and a priority 3 alarm is active, the REFERENCE_NOT_FOUND error appears, as the isAlarmActiveFiltered function for priority 4 alarms errors when no alarm is configured that meets the filter criteria.

The only solutions I can see currently are to create dummy alarms for each priority you don’t intend to configure, disable the overlay, or reduce the priorities you’re filtering for to only ones that you have configured. For my use case, option 1 seems like the appropriate solution.

1 Like

That was my takeaway as well, if no suitable alarms are found (or exist, but are disabled) the REFERENCE_NOT_FOUND gets thrown by the expression and cannot be caught in a TRY block.

Thanks for sharing your experience with this Chris.