# isAlarmActiveFiltered throws REFERENCE\_NOT\_FOUND when alarms not enabled

**URL:** <https://forum.inductiveautomation.com/t/isalarmactivefiltered-throws-reference-not-found-when-alarms-not-enabled/23933>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [April 8, 2019, 6:59pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-throws-reference-not-found-when-alarms-not-enabled/23933 "2019-04-08T18:59:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [April 8, 2019, 6:59pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-throws-reference-not-found-when-alarms-not-enabled/23933/1 "2019-04-08T18:59:46Z")

</div>

Howdy,

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.

Example:

```auto
try(
	isAlarmActiveFiltered(
		'[default]pathTo/AlarmedTag',	// tagPath
		'*', // alarmName
		'*', // displayPath
		0, // minPriority
		4, // maxPriority
		False,	// allowCleared
		True,	// allowAcked
		True	// allowShelved
	),
	0
)

```

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7433fdaa37aab4fdb4a481ab520fa2b3920cffc5.png)

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [April 8, 2019, 10:09pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-throws-reference-not-found-when-alarms-not-enabled/23933/2 "2019-04-08T22:09:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![chriss](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chriss](https://forum.inductiveautomation.com/u/chriss)\
**Post date:** [July 24, 2019, 6:11pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-throws-reference-not-found-when-alarms-not-enabled/23933/3 "2019-07-24T18:11:28Z")

</div>

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}:

```auto
if(isAlarmActive("[default]{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.

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [July 24, 2019, 6:27pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-throws-reference-not-found-when-alarms-not-enabled/23933/4 "2019-07-24T18:27:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [December 6, 2022, 3:03am UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-throws-reference-not-found-when-alarms-not-enabled/23933/5 "2022-12-06T03:03:58Z")

</div>

This is still the case in 8.1.23. Is there anyway to catch this and have it return a false instead of a bad result? A function parameter to return false for nothing found would be ideal.
