# How to get the actual value of Alarm Associated Data properties with expression binding via scripting

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-the-actual-value-of-alarm-associated-data-properties-with-expression-binding-via-scripting/77264>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [August 2, 2023, 3:52am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-actual-value-of-alarm-associated-data-properties-with-expression-binding-via-scripting/77264 "2023-08-02T03:52:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tyler.bennett](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@tyler.bennett](https://forum.inductiveautomation.com/u/tyler.bennett)\
**Post date:** [August 2, 2023, 3:52am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-actual-value-of-alarm-associated-data-properties-with-expression-binding-via-scripting/77264/1 "2023-08-02T03:52:32Z")

</div>

I'm looking for a straight forward scripted means to get the value of an Alarm Associated Data property that has an expression binding (Ignition v8.1). I want the current value of the property, not the definition of the binding.

**Use case (not super important to the request above)**  
For the alarm configuration of each alarm that is to produce audible notification we add an [Alarm Associated Data](https://docs.inductiveautomation.com/display/DOC81/Alarm+Associated+Data) property named "AudibleAlertFileName". The presence of this alarm property flags the alarm as triggering audible notification and value of this property indicates the filename for the pre-generated audio clip that will be added to the notification queue.

Due to extensive use of UDTs in many cases the value of the "AudibleAlertFileName" is generated by an expression binding to make it dynamic for different UDT instances without needing to override the entire alarm configuration on each UDT instance. For example: `"pod_"+{Pod Number}+"_liquid_level_high.mp3"`

I wish to make a scripted query to:

1. Identify all alarm configurations that have the "AudibleAlertFileName" alarm property defined
2. Return the path for each of those alarm configurations.
3. Return the value of the "AudibleAlertFileName" alarm property (not the binding definition) for each of those alarm configurations.

**Failed Attempts**  
Using the [system.alarm.queryStatus](https://docs.inductiveautomation.com/display/DOC81/system.alarm.queryStatus) function does not suffice as that only return alarm events and does not include alarm configuration that does not have an current event.

```python
alarm_property_name = "AudibleAlertFileName"

print "Finding alarm events with '{}' defined...".format(alarm_property_name)

events = system.alarm.queryStatus(
	priority =[0,1,2,3,4]
	, defined = [alarm_property_name]
)

for event in events:
	print event, event.activeData
print "Done"

```

Alternatively, using [system.tag.query](https://docs.inductiveautomation.com/display/DOC81/system.tag.query) to return a list of tags with alarms and the iterating through the alarm data for each of those tags yields enough info produce the path to the alarm configuration but gives the the expression binding definition for the "AudibleAlertFileName" alarm property, not an actual value.

```python
query = {
    "options": {
        "includeUdtMembers": True,
        "includeUdtDefinitions": False
    },
    "condition": {
        "attributes": {
            "values": ["alarm"],
            "requireAll": True
        }
    },
    "returnProperties": [
        "alarms"
    ]
}

results = system.tag.query('default', query)

# Filter the results to include only alarms having "AudibleAlertFileName" defined.
filtered_results = []
for result in results:
    alarms = result.get("alarms")
    if alarms:
        for alarm in alarms:
            if alarm.has_key("AudibleAlertFileName"):
                filtered_results.append({
                	"fullPath":result.get("fullPath")
                	, "alarm_name":alarm.get("name")
                	, "AudibleAlertFileName":alarm.get("AudibleAlertFileName")
                })

count=0
for fr in filtered_results:
	print count, fr
	count += 1

```

Example return value:

```auto
22 {'fullPath': [default]Pod 9/Cooler/Fault, 'alarm_name': u'Cooler Fault', 'AudibleAlertFileName': {u'bindType': u'Expression', u'value': u'"pod_"+{Pod Number}+"_cooler_faulted.mp3"'}}
23 {'fullPath': [default]Pod 4/Pod Tub Level Switches, 'alarm_name': u'Tub High Level', 'AudibleAlertFileName': {u'bindType': u'Expression', u'value': u'"pod_"+{Pod Number}+"_liquid_level_high.mp3"'}}

```

Any help is appreciated. I have that nagging feeling that I'm overlooking something dead simple.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 2, 2023, 12:21pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-actual-value-of-alarm-associated-data-properties-with-expression-binding-via-scripting/77264/2 "2023-08-02T12:21:41Z")

</div>

Just read the alarm prop from the tag with system.tag.readBlocking

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 2, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-actual-value-of-alarm-associated-data-properties-with-expression-binding-via-scripting/77264/3 "2023-08-02T13:26:00Z")

</div>

If you truly need to, you might be able to cobble something together that gives you the right result with `system.util.evalExpression` from [Ignition Extensions](https://forum.inductiveautomation.com/t/ignition-extensions-convenience-utilities-for-advanced-users/64615#systemutilevalexpressionexpression-arguments-qualifiedvalue-5).

---

<div class="post-metadata">

**Author:** ![tyler.bennett](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@tyler.bennett](https://forum.inductiveautomation.com/u/tyler.bennett)\
**Post date:** [August 16, 2023, 2:33pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-actual-value-of-alarm-associated-data-properties-with-expression-binding-via-scripting/77264/4 "2023-08-16T14:33:20Z")

</div>

> [@nminchin](#):
>
> Just read the alarm prop from the tag with system.tag.readBlocking

I suppose that is true and probably the simplest solution, thanks. I was in the mindset of getting the property value included with the query results, thinking that performing an additional system.tag.readBlocking call on each might be "expensive".
