# Filter out alarm

**URL:** <https://forum.inductiveautomation.com/t/filter-out-alarm/91167>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [May 30, 2024, 8:05pm UTC](https://forum.inductiveautomation.com/t/filter-out-alarm/91167 "2024-05-30T20:05:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Cockrell](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@Brian\_Cockrell](https://forum.inductiveautomation.com/u/Brian_Cockrell)\
**Post date:** [May 30, 2024, 8:05pm UTC](https://forum.inductiveautomation.com/t/filter-out-alarm/91167/1 "2024-05-30T20:05:41Z")

</div>

I am filtering alarms based on a folder partial name lets say CB2 using the display path filter _CB2_.

The problem is there are inhib alarms ending in INHIB that i do not want to show.

I have tried a script

```python
Def filterAlarm(self, alarmevent):
       name = alarmevent.get("name")
       If name != "%INHIB%":
              Return True
       Return False

```

Thus doesnt seem to do anything. I dint have any errors in the console log but the inhib alarms still show in the alarm table.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Brian\_Cockrell](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@Brian\_Cockrell](https://forum.inductiveautomation.com/u/Brian_Cockrell)\
**Post date:** [May 30, 2024, 8:06pm UTC](https://forum.inductiveautomation.com/t/filter-out-alarm/91167/2 "2024-05-30T20:06:44Z")

</div>

And yes there are astericks on both sides of CB2.

---

<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:** [May 30, 2024, 8:10pm UTC](https://forum.inductiveautomation.com/t/filter-out-alarm/91167/3 "2024-05-30T20:10:19Z")

</div>

Python doesn't have `LIKE` operator, and supplying `%` to a python comparison doesn't magically make it work that way. What python _does_ have is the `in` operator, which will return true if a string is anywhere within another string.

(Please fix your post to apply code formatting using the "preformatted text" button in the forum editor. So I can copy and paste from your code to make an example.)

---

<div class="post-metadata">

**Author:** ![Brian\_Cockrell](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@Brian\_Cockrell](https://forum.inductiveautomation.com/u/Brian_Cockrell)\
**Post date:** [May 30, 2024, 8:16pm UTC](https://forum.inductiveautomation.com/t/filter-out-alarm/91167/4 "2024-05-30T20:16:43Z")

</div>

sorry about that i haven't ever posted code before.

---

<div class="post-metadata">

**Author:** ![Brian\_Cockrell](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@Brian\_Cockrell](https://forum.inductiveautomation.com/u/Brian_Cockrell)\
**Post date:** [May 30, 2024, 8:24pm UTC](https://forum.inductiveautomation.com/t/filter-out-alarm/91167/5 "2024-05-30T20:24:40Z")

</div>

I think i got it with

```python
Def filterAlarm(self, alarmevent):
       name = alarmevent.get("name")
       If "INHIB" not in name
              Return True
       Return False

```

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [May 30, 2024, 8:37pm UTC](https://forum.inductiveautomation.com/t/filter-out-alarm/91167/6 "2024-05-30T20:37:02Z")

</div>

Given Python's case sensitive key words, I would be surprised if that snippet ran. There are several words capitalized that shouldn't be.

I didn't test, but this should be logically equivalent to the snippet above (with improved capitalization).

```python
def filterAlarm(self, alarmevent):
    name = alarmevent.get("name")
    return "INHIB" not in name

```
