# Perspective alarm filtering - how to prefilter on display path and multiple conditions

**URL:** <https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 22, 2023, 9:41am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010 "2023-05-22T09:41:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [May 22, 2023, 9:41am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/1 "2023-05-22T09:41:46Z")

</div>

Hi  
I need to filter alarms on 2 conditions:  
1 - first condition is "AlarmName" which is at the end part of the display path string eg. "TagFolder/TagName/AlarmName" - would using filterAlarm extension function be the right way? i was struggling with the syntax to get it right even in the simplest form.

> def filterAlarm(self, alarmEvent):  
> AlarmDisplayPath = str(alarmEvent.get('displayPath'))  
> return "TagFolder/TagName/AlarmName" == AlarmDisplayPath

what about adding wildcards - is it allowed at all?  
After prefiltering i could use tag path filter on display path again or on source  
2 - alternatively instead using extenstion funciton i could use 1 condition for source (to filter AlarmName) and then use displayPath to filter alarms by tag name .  
I wonder if both methods are equal - would extension function be a lot faster and preferred from performance point of view?  
3 - how to figure out exact property names that are available in the extension functions for alarmEvent - "priority" was mentioned in the docs page but i wonder what else ? i could not figure out an exhaustive list ☹

---

<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:** [May 22, 2023, 10:12am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/2 "2023-05-22T10:12:01Z")

</div>

What's the second filter ? The tag name ?  
So you'd be filtering on alarm name and tag name ?

> [@hewking32](#):
>
> what about adding wildcards - is it allowed at all?

You can use wildcards in the filter properties, but not in the extension function: there's no wildcard in python.  
For the extension function, you'd need to use a regex or use other built-in ways (ie: `in`, `startswith`, etc)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 22, 2023, 10:16am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/3 "2023-05-22T10:16:00Z")

</div>

> [@pascal.fragnoud](#):
>
> there's no wildcard in python

You can effectively achieve the same end as a wildcards with simple string logic like this:

```auto
return "TagFolder/TagName/" in AlarmDisplayPath

```

> [@pascal.fragnoud](#):
>
> built-in ways (ie: `in`, `startswith`, etc)

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [May 22, 2023, 10:21am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/4 "2023-05-22T10:21:53Z")

</div>

thanks for useful hints  
regarding extension functions is expression language used or python or maybe both? this confuses me to know which syntax i am actually looking for

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 22, 2023, 10:23am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/5 "2023-05-22T10:23:08Z")

</div>

> [@hewking32](#):
>
> extension functions

These are python.

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [May 22, 2023, 10:27am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/6 "2023-05-22T10:27:24Z")

</div>

i already have a good gist but is it possible to say where expression language and where python is used - is any overall rule to that?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 22, 2023, 10:30am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/7 "2023-05-22T10:30:13Z")

</div>

I generally associate expressions with bindings [not transformations], and python or jython is used pretty much everywhere else.

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [May 22, 2023, 10:50am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-filtering-how-to-prefilter-on-display-path-and-multiple-conditions/74010/8 "2023-05-22T10:50:56Z")

</div>

yes i am using Tag name as second filter  
Filtering using displaypath for first condition and source for second condition works fine but i have deeper issue. I am not able to acknowledge alarms which are filtered but these alarms have fired and they add to the gateway alarm count for active/unacknowledge alarms which are then displayed. Is the only way to fix that to use extension function with reg-ex to pre-filter and prevent alarm from adding an entry and prevent from adding to the gateway alarm count statistics?
