# Referring Alarm associated data into an expression

**URL:** <https://forum.inductiveautomation.com/t/referring-alarm-associated-data-into-an-expression/15425>\
**Category:** Ignition\
**Created:** [September 21, 2017, 9:15am UTC](https://forum.inductiveautomation.com/t/referring-alarm-associated-data-into-an-expression/15425 "2017-09-21T09:15:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anwesha\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@Anwesha\_Gupta](https://forum.inductiveautomation.com/u/Anwesha_Gupta)\
**Post date:** [September 21, 2017, 9:15am UTC](https://forum.inductiveautomation.com/t/referring-alarm-associated-data-into-an-expression/15425/1 "2017-09-21T09:15:57Z")

</div>

![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/d3ac8059ac75ca66bec22c039d78d76820d682d6.PNG)Hello Everyone,

I am in the process of filtering alarms based on a property called ‘Category’ in the alarm associated data.  
Alarm journal or Alarm table works absolutely fine with this filtering.  
The next step is to filter the alarms and use in further calculations. I am trying to use the Gateway event scripting to do the calculations on the filtered alarms.  
In order to do the calculations, I need to refer to the filtering of alarm associated data into this expression.  
Can someone please help as to how can I refer an alarm associated data in expression (Scripting).

In the above screen shot, the calculation works fine without filtering. I need to use the associated data filtering in this script and run the calculation on the filtered alarms.

Thanks &Regards

---

<div class="post-metadata">

**Author:** ![hamlinjr](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hamlinjr/32/8228_2.png) [@hamlinjr](https://forum.inductiveautomation.com/u/hamlinjr)\
**Post date:** [September 22, 2017, 1:12pm UTC](https://forum.inductiveautomation.com/t/referring-alarm-associated-data-into-an-expression/15425/2 "2017-09-22T13:12:39Z")

</div>

You could use the any\_properties or all\_properties parameter.

For example, if your associated data name were “category” and its value was “cat 1”, and you wanted to only count alarms that were “cat 1” you could modify your script like this:

```auto
FACritical = len(system.alarm.queryStatus(priority=['Critical'],state=['ActiveUnacked'],path=['*'+site+'/*'],any_properties=[('category','=','cat 1')]))

```

More information here: [system.alarm.queryStatus()](https://docs.inductiveautomation.com/display/DOC79/system.alarm.queryStatus)

---

<div class="post-metadata">

**Author:** ![Anwesha\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@Anwesha\_Gupta](https://forum.inductiveautomation.com/u/Anwesha_Gupta)\
**Post date:** [October 2, 2017, 8:45am UTC](https://forum.inductiveautomation.com/t/referring-alarm-associated-data-into-an-expression/15425/3 "2017-10-02T08:45:51Z")

</div>

Thanks a lot.  
This works absolutely fine. I did go through the user manual on any properties or all properties earlier. But couldn’t find a way to write the exact syntax.  
Your reply was spot on. Thank you 🙂

---

<div class="post-metadata">

**Author:** ![Anwesha\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@Anwesha\_Gupta](https://forum.inductiveautomation.com/u/Anwesha_Gupta)\
**Post date:** [October 2, 2017, 1:50pm UTC](https://forum.inductiveautomation.com/t/referring-alarm-associated-data-into-an-expression/15425/4 "2017-10-02T13:50:30Z")

</div>

Hello,

I have a following question on any\_properties or all\_properties parameter.  
Can I use ‘\*’ to refer to part of string in this parameter?

```auto
FACritical = len(system.alarm.queryStatus(priority=['Critical'],state=['ActiveUnacked'],path=['*'+site+'/*'],any_properties=[('category','=','cat 1')]))

```

in the above example - if category is defined as Cat1234, Cat2345, Cat3456 etc… can I use

any\_properties=[(‘category’,’=’,‘cat\*’)]))

The \* doesn’t seem to be taking the values after the word Cat.

I have also tried - any\_properties=[(‘category’,’=’,‘cat’+’\*’)]))  
This also returns value of 0.

Any suggstions on how to use concatenation within this any\_properties parameter?

Thanks & Regards  
Anwesha.
