# isAlarmActiveFiltered() not detecting shelved alarms

**URL:** <https://forum.inductiveautomation.com/t/isalarmactivefiltered-not-detecting-shelved-alarms/36061>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [June 25, 2020, 9:56pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-not-detecting-shelved-alarms/36061 "2020-06-25T21:56:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cory.grube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cory.grube/32/20476_2.png) [@Cory.grube](https://forum.inductiveautomation.com/u/Cory.grube)\
**Post date:** [June 25, 2020, 9:56pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-not-detecting-shelved-alarms/36061/1 "2020-06-25T21:56:21Z")

</div>

(Version 8.0.13)

I’m trying to use alarm-based visibility animations to show different symbols when different priority alarms are active or shelved. I configured two alarms on a single tag for ease of testing. I use coalesce() with isAlarmActiveFiltered() to tell me the highest priority that’s active. See my expression below:

```auto
coalesce(
	// Check active High/Critical alarms (priority 3-4)
	// Return 5
	if(
		isAlarmActiveFiltered("*","*","*",3,4,0,1,0),
		5,
		null
	),
	
	// Check active Medium alarms (priority 2)
	// Return 4
	if(
		isAlarmActiveFiltered("*","*","*",2,2,0,1,0),
		4,
		null
	),
	
	// Check active Low alarms (priority 1)
	// Return 3
	if(
		isAlarmActiveFiltered("*","*","*",1,1,0,1,0), 
		3,
		null
	),

	// Check active Diagnostic alarms (priority 0)
	// Return 2
	if(
		isAlarmActiveFiltered("*","*","*",0,0,0,1,0),
		2,
		null
	),
	
	// Check active Shelved alarms (any priority 0-4)
	// Return 1
	if(
		isAlarmActiveFiltered("*","*","*",0,4,0,1,1),
		1,
		null
	),
	
	// No alarms active or shelved.
	// Return 0
	0
)

```

Note that in practice, the first wildcard of isAlarmActiveFiltered() (tagPath) will be replaced with ‘[tagProvider]tag/Path’.

My problem is that shelved alarms don’t get detected by the last isAlarmActiveFiltered(). When I shelve all active alarms, the expression outputs 0 instead of 1. I’ve also tried using that last instance as a standalone expression and it will return 1 when an alarm is active and unshelved, and 0 when it is shelved or cleared. I would expect 1 when active or shelved, and 0 when cleared.

Am I using the function incorrectly, is it not meant to do this, or is this a bug?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Cory.grube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cory.grube/32/20476_2.png) [@Cory.grube](https://forum.inductiveautomation.com/u/Cory.grube)\
**Post date:** [July 1, 2020, 9:44pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-not-detecting-shelved-alarms/36061/2 "2020-07-01T21:44:17Z")

</div>

Update - I've been in touch with support and they confirmed this is a bug, not user error. A bug ticket has been created, but there is no ETA the fix.

I've also learned that my use of this function in the client scope is poor form and could cause hangups:

> [@Choosing Ignition Client CPUs](http://forum.inductiveautomation.com/t/choosing-ignition-client-cpus/34183/6):
>
> This is common if you make the mistake of using runScript in a binding to execute alarm functions, use the isAlarmActive expression in a client binding, or do anything else that requires a request to the gateway on the UI thread (as @pturmel already mentioned).

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 1, 2020, 10:03pm UTC](https://forum.inductiveautomation.com/t/isalarmactivefiltered-not-detecting-shelved-alarms/36061/3 "2020-07-01T22:03:33Z")

</div>

> [@Cory.grube](#):
>
> my use of this function in the client scope is poor form

~~No, not the use in client scope. The use on the foreground thread (which is where runScript bindings execute).~~

Nevermind. That's the expression function, which can only be run in a binding. So yes, anything other than gateway/perspective scope is trouble.
