# Getting alarm data and time from Alarm Status Table

**URL:** <https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [January 19, 2022, 3:02pm UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171 "2022-01-19T15:02:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RC23](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@RC23](https://forum.inductiveautomation.com/u/RC23)\
**Post date:** [January 19, 2022, 3:02pm UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/1 "2022-01-19T15:02:59Z")

</div>

Hi there,

I am trying to get the most recent active unacknowledged alarm and display it on a single-line field but I can’t seem to find the data that I look for under the props.  
Is there a way to access these info? I also would like to use custom buttons to silence and/or acknowledge it.

Thanks,

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [January 21, 2022, 1:08pm UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/2 "2022-01-21T13:08:12Z")

</div>

You can use scripting to do this.

You can search all the alarms for the active and unacknowledged ones with this one:  
[https://docs.inductiveautomation.com/display/DOC81/system.alarm.queryStatus](https://docs.inductiveautomation.com/display/DOC81/system.alarm.queryStatus)

You can shelve and acknowledge alarms with these:  
[https://docs.inductiveautomation.com/display/DOC81/system.alarm.acknowledge](https://docs.inductiveautomation.com/display/DOC81/system.alarm.acknowledge)  
[https://docs.inductiveautomation.com/display/DOC81/system.alarm.shelve](https://docs.inductiveautomation.com/display/DOC81/system.alarm.shelve)

---

<div class="post-metadata">

**Author:** ![RC23](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@RC23](https://forum.inductiveautomation.com/u/RC23)\
**Post date:** [January 25, 2022, 8:46am UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/3 "2022-01-25T08:46:30Z")

</div>

Hi,

Thanks for the reply.  
I used the system.alarm.queryStatus and can receive something like this:

{Source: ‘prov:default:/tag:_GenSim_/Realistic/Realistic0:/alm:High Alarm’, Display Path: ‘’, UUID: ‘426d0ccd-88ef-4c9a-b501-f3adb6c003fe’, Current State: ‘Active, Unacknowledged’, Priority: ‘Critical’, Active Data: {mode=Above Setpoint, setpointA=35.0, eventValue=39.34168542734694, name=High Alarm, eventTime=Tue Jan 25 09:32:31 CET 2022, priority=Critical}, Clear Data: null, Ack Data: null, Runtime Data: {isShelved=false}}

In fact, I only need time and alarm description. How can I extract those?

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [January 25, 2022, 1:30pm UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/4 "2022-01-25T13:30:08Z")

</div>

Alarm.queryStatus() returns a PyAlarmEvent (if in 1.8.11) You can read about what data you can get from it here: [Scripting Object Reference - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Scripting+Object+Reference#ScriptingObjectReference-PyAlarmEvent)

In the latest version of Ignition this code should work:

```auto
data = system.alarm.queryStatus(state = ["ActiveUnacked", "ActiveAcked"])
for alarm in data:
	print alarm["EventTime"]
	print alarm.getLabel()

```

---

<div class="post-metadata">

**Author:** ![RC23](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@RC23](https://forum.inductiveautomation.com/u/RC23)\
**Post date:** [January 25, 2022, 4:28pm UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/5 "2022-01-25T16:28:16Z")

</div>

I tried it and but I get the following error:

TypeError: ‘com.inductiveautomation.ignition.common.alarming.BasicAlarmEvent’ object is unsubscriptable

Even this code sample in the documentation throws the same error;

`results ` `=` `system.alarm.queryStatus()`

`for` `i ` `in` `results:`

` ` `print` `i[` `"EventId"` `]`

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [January 25, 2022, 5:38pm UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/6 "2022-01-25T17:38:34Z")

</div>

This would be because that code only works in 8.1.11, your gateway must be an older version. In older versions the returns are AlarmEvent objects rather than PyAlarmEvent objects, so the code will be a little different. Here’s info about it: [AlarmEvent](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.10/com/inductiveautomation/ignition/common/alarming/AlarmEvent.html)

Pretty sure this would work:

```auto
data = system.alarm.queryStatus(state = ["ActiveUnacked", "ActiveAcked"])
for alarm in data:
	print alarm.getActiveData().getTimestamp()
	print alarm.getLabel()

```

---

<div class="post-metadata">

**Author:** ![RC23](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@RC23](https://forum.inductiveautomation.com/u/RC23)\
**Post date:** [January 26, 2022, 7:22am UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/7 "2022-01-26T07:22:28Z")

</div>

It is 8.1.10. Will upgrade and check again.  
Thank you very much for the help though!

---

<div class="post-metadata">

**Author:** ![RC23](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@RC23](https://forum.inductiveautomation.com/u/RC23)\
**Post date:** [January 27, 2022, 7:21am UTC](https://forum.inductiveautomation.com/t/getting-alarm-data-and-time-from-alarm-status-table/55171/8 "2022-01-27T07:21:28Z")

</div>

It worked after the upgrade as you mentioned. Once again, thank you very much for the help!
