# Accessing Alarm Associated Data in scripting

**URL:** <https://forum.inductiveautomation.com/t/accessing-alarm-associated-data-in-scripting/31198>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [January 9, 2020, 9:04pm UTC](https://forum.inductiveautomation.com/t/accessing-alarm-associated-data-in-scripting/31198 "2020-01-09T21:04:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveD24](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@DaveD24](https://forum.inductiveautomation.com/u/DaveD24)\
**Post date:** [January 9, 2020, 9:04pm UTC](https://forum.inductiveautomation.com/t/accessing-alarm-associated-data-in-scripting/31198/1 "2020-01-09T21:04:49Z")

</div>

Is it possible to access associated alarm data from alarm objects return by the system.alarm.queryStatus() function?

---

<div class="post-metadata">

**Author:** ![DaveD24](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@DaveD24](https://forum.inductiveautomation.com/u/DaveD24)\
**Post date:** [January 10, 2020, 1:38pm UTC](https://forum.inductiveautomation.com/t/accessing-alarm-associated-data-in-scripting/31198/2 "2020-01-10T13:38:41Z")

</div>

Finally found a solution and share that here in case it is useful to anyone else.  
Basically the activeData object of each alarm in the list returned form system.alarm.queryStatus() has a bunch of properties within that include any associated(Custom) properties, by iterating though all the activeData properties and building a Python Dict, I could then test the Dict keys to see if my associated data was present, I guess there is better way but it works.

```auto
alarms = system.alarm.queryStatus( priority	= ['Low', 'Medium', 'High', 'Critical'],
                                   state	= ["ActiveUnacked", "ActiveAcked"]
				                         )
for alarm in alarms:	
	props={}
	for item in alarm.activeData:
		props[str(item.getProperty())]=item.getValue()
	if 'associatedDataName ' in props.keys():
		Process the property here

```

---

<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 11, 2023, 12:01pm UTC](https://forum.inductiveautomation.com/t/accessing-alarm-associated-data-in-scripting/31198/3 "2023-05-11T12:01:50Z")

</div>

How do you process the property. I have associated data named group and can print the prop that shows the he prop data including yhe group but i can figure out how to test if that group equals something do something else

---

<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:** [June 4, 2023, 12:46am UTC](https://forum.inductiveautomation.com/t/accessing-alarm-associated-data-in-scripting/31198/4 "2023-06-04T00:46:24Z")

</div>

> [@Brian\_Cockrell](#):
>
> How do you process the property

```
if 'associatedDataName' in props.keys():
	#processing associated data example:
	associatedDataValue = props['associatedDataName']
	print associatedDataValue #do something with this value

```

---

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [September 22, 2024, 6:51pm UTC](https://forum.inductiveautomation.com/t/accessing-alarm-associated-data-in-scripting/31198/6 "2024-09-22T18:51:28Z")

</div>

This works nicely. My Associated Data name is `Alarm Description`.

```python
eventID = [("EventId","=","255600b2-fa1c-4182-9660-a405ee11e572")]
results = system.alarm.queryStatus(all_properties=eventID)
result = results[0]
print("result property Alarm Description = " + str(result.get("Alarm Description")))

```
