# \[Feature-2383\] Filtering shelved alarms

**URL:** <https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [June 14, 2021, 2:03pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744 "2021-06-14T14:03:30Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 14, 2021, 2:03pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/1 "2021-06-14T14:03:30Z")

</div>

Hello folks,

I have an issue with the Alarm Status Table: the shelved tab shows alarms that belong to other projects.  
I have no idea how to fix that… I tried the filtering extension function, but it seems to only filter alarms in the active alarms list, not the shelved ones.  
The filter properties are not enough, as the user can just get rid of those.

Do I have a misconfiguration somewhere ? Did I miss an option somewhere ?  
For now I just filtered the alarms and disabled the option of filtering for the user, but that’s not ideal, especially considering it still shows the number of shelved alarms in the tab title…

Please send help 😃

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 14, 2021, 2:54pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/2 "2021-06-14T14:54:02Z")

</div>

Tags are Gateway-scoped, so all projects can see all Tags. If your tags are split into different providers for each project, you could filter on the provider. You could also filter based on the source or Display Path if you happen to have configured your tags in such a way that you can determine which project a tag belongs to by looking at the Source of the tag.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 14, 2021, 4:00pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/3 "2021-06-14T16:00:27Z")

</div>

How can I filter things ? I could not find anything that allowed me to filter the shelved alarms…

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 14, 2021, 4:24pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/4 "2021-06-14T16:24:38Z")

</div>

Oh, you’re right - we have not implemented the `conditions` property for shelved alarms yet. We have an open feature request to provide the same filtering capabilities to both the shelved and active tabs, but it has not been started yet. For now there is no way to filter the shelved tab alarms by provider, source or display path.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 15, 2021, 6:28am UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/5 "2021-06-15T06:28:49Z")

</div>

Oh… damn.  
Any workaround that would provide a bit more flexibility than what I’m doing currently ? Which is imposing a text filter and disabling the option for the user to change that filter…  
And an ETA on that feature ?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 15, 2021, 2:40pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/6 "2021-06-15T14:40:04Z")

</div>

You could use the filtering present in the extension function: filterAlarm.

Look at the [documentation](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Alarm+Status+Table) for the Alarm Status Table to learn more about how to use this filter. This could also be modified at runtime if you want to set up some additional components to drive the logic. The downside is this route can impact performance for tag-heavy systems because it executes the logic for all alarms every time the table polls.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 15, 2021, 2:45pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/7 "2021-06-15T14:45:40Z")

</div>

I have read that page and did try the filterAlarm extension function, but it seemed to only filter active alarms, not the shelved ones. To make sure of that, I made it return False all the time, and shelved alarms were still showing up.  
Did I miss something ?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 15, 2021, 2:50pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/8 "2021-06-15T14:50:50Z")

</div>

> [@pascal.fragnoud](#):
>
> but it seemed to only filter active alarms, not the shelved ones.

That sounds like a bug. If that is indeed true, then I'm sorry to say I have no other workarounds for you. I'm not in a position where I can verify the behavior just yet, but I'll try it out first thing when I arrive at the office.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 15, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/9 "2021-06-15T15:00:12Z")

</div>

I’ll give it another shot in case I messed something up, then report back.

It seems I didn’t mess it up… So that’s a bug then.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/d/ad17c601d49268b54cc5775d2d91f023c57c56f1.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 15, 2021, 4:08pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/10 "2021-06-15T16:08:32Z")

</div>

Yes, I was able to replicate it as well. I’ve reached out to Dev to see if this might be expected behavior, because I think shelved alarms might be managed differently and so they might bypass that filtering. I’m waiting to hear back, but regardless, this will not work for you as of right now.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 15, 2021, 4:50pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/11 "2021-06-15T16:50:38Z")

</div>

I haven’t gotten a response from the original Dev, so I’ve opened an internal ticket until a determination can be made. If you need to reference this internal ticket at any time (during a Support inquiry, for example), you can supply 2885 as the reference number.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 15, 2021, 9:07pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/12 "2021-06-15T21:07:27Z")

</div>

Thanks a lot, hope this can find a fix soon.

---

<div class="post-metadata">

**Author:** ![Simen](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Simen](https://forum.inductiveautomation.com/u/Simen)\
**Post date:** [March 13, 2023, 12:53pm UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/13 "2023-03-13T12:53:18Z")

</div>

I see that this function is now added with a Extension Function called filterShelvedAlarm

It is documented with some example code.  
I struggled a bit working out how to filter on more than one single alarm. Wildcards didnt seem to work. I doubt many are interested in filtering out one specific source string.

```auto
# display only shelved alarms from a specific sourcePath:
 
source = shelvedAlarmEvent.get('sourcePath')
if source == 'prov:default:/tag:myTag/Mode:/alm:myAlarm':
    return True
return False

```

I think it would be smart to update the example to something like this:

```auto
# display only shelved alarms containing this sourcePath:

def filterShelvedAlarm(self, shelvedAlarmEvent):
	source = shelvedAlarmEvent.get('sourcePath')
	if 'prov:myTagProvider:/tag:folder1/folder2/' in source:
	    return True
	return False

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 14, 2023, 8:08am UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/14 "2023-03-14T08:08:55Z")

</div>

> [@Simen](#):
>
> Wildcards didnt seem to work

It's a jython script, so you can only use what jython knows. It doesn't do wildcards just like that, but you can use regexes. Thought I really wouldn't throw a regex in for this simple case.

They could add examples, but... this is very basic python. They can't just add python courses to the documentation of every function.

---

<div class="post-metadata">

**Author:** ![Simen](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Simen](https://forum.inductiveautomation.com/u/Simen)\
**Post date:** [March 14, 2023, 8:49am UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/15 "2023-03-14T08:49:27Z")

</div>

Thats a fair point.. 🙂  
Guess I better head over to w3schools and start studying.  
They do have an example, and it filters out a single alarm, and I thought that was a bit odd because I don't see any use cases for it.  
Started on a post while trying to figure out how to do it. But I found a solution along the way, and decided to post something about how I solved it, incase others were searching the forums for a solution.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [March 14, 2023, 9:23am UTC](https://forum.inductiveautomation.com/t/feature-2383-filtering-shelved-alarms/47744/16 "2023-03-14T09:23:44Z")

</div>

It's a good solution.

There's just one thing you could change: Instead of returning `True` or `False` depending on a condition, you could directly return the evaluation of that condition:

```python
return 'prov:myTagProvider:/tag:folder1/folder2/' in source

```
