# ACK all from external button

**URL:** <https://forum.inductiveautomation.com/t/ack-all-from-external-button/6680>\
**Category:** Ignition\
**Created:** [June 10, 2013, 5:09pm UTC](https://forum.inductiveautomation.com/t/ack-all-from-external-button/6680 "2013-06-10T17:09:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinmarchand](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@kevinmarchand](https://forum.inductiveautomation.com/u/kevinmarchand)\
**Post date:** [June 10, 2013, 5:09pm UTC](https://forum.inductiveautomation.com/t/ack-all-from-external-button/6680/1 "2013-06-10T17:09:41Z")

</div>

Hi,

```
I start using the new alarm system and I need to setup an external ACK all button.
Can you suggest an easy way to acknoledge all alarm with a button script.

```

thanks

---

<div class="post-metadata">

**Author:** ![tsmith](https://avatars.discourse-cdn.com/v4/letter/t/f0a364/32.png) [@tsmith](https://forum.inductiveautomation.com/u/tsmith)\
**Post date:** [June 11, 2013, 5:35pm UTC](https://forum.inductiveautomation.com/t/ack-all-from-external-button/6680/2 "2013-06-11T17:35:28Z")

</div>

I’m certian there is a more elegant way, but this worked for me. Hope this helps!

#=================================================#  
#Global Alarm Ack Button - Script  
#Rev 1.0, by T. Smith 6/11/13, C: 303.827.1337  
#Samuel Engineering, Denver CO  
#Rev 1 Note: Original  
#  
#Rev 2 Note:  
#  
#=================================================#

#Test Table (Rem out when not used, delete when test complete)

# If the developer places a table on the same screen, named “table”

# it will display the same unacked data as the alarm window.

#----------------------------------------------------------------------#  
#table = event.source.parent.getComponent(“Table”)  
#UnackedAlarms = system.alarm.queryStatus(state=[“ActiveUnacked”])  
#table.data = UnackedAlarms.getDataset()

#Define Variables  
#Get all Active and Unacked alarms  
#----------------------------------------------------------------------#  
UnackedAlarms = system.alarm.queryStatus(state=[“ActiveUnacked”])  
AlmData = UnackedAlarms.getDataset() #Create dataset of Unacked alarms

#Loop Through all alarms, and acknowledge them one at a time  
#----------------------------------------------------------------------#  
#Declare variables  
idx = 0  
#For Loop through list and ack   
for r in results:  
resultevent = str(Mydata.getValueAt(idx,‘EventId’)) #Get Alarm Event ID  
system.alarm.acknowledge([resultevent],"") #Execute Ack

#Execute Associated PLC tags here  
#----------------------------------------------------------------------#  
#Plc\_Alarm\_Ack\_Tag

---

<div class="post-metadata">

**Author:** ![tsmith](https://avatars.discourse-cdn.com/v4/letter/t/f0a364/32.png) [@tsmith](https://forum.inductiveautomation.com/u/tsmith)\
**Post date:** [June 11, 2013, 5:39pm UTC](https://forum.inductiveautomation.com/t/ack-all-from-external-button/6680/3 "2013-06-11T17:39:45Z")

</div>

There was a typo on the For Loop portion of the code, the corection is below…

#Loop Through all alarms, and acknowledge them  
#----------------------------------------------------------------------#  
#Declare variables  
idx = 0  
#For Loop through list and ack   
for r in results:  
resultevent = str(AlmData.getValueAt(idx,‘EventId’)) #Get Alarm Event ID  
system.alarm.acknowledge([resultevent],"") #Execute Ack

---

<div class="post-metadata">

**Author:** ![kevinmarchand](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@kevinmarchand](https://forum.inductiveautomation.com/u/kevinmarchand)\
**Post date:** [June 11, 2013, 5:58pm UTC](https://forum.inductiveautomation.com/t/ack-all-from-external-button/6680/4 "2013-06-11T17:58:17Z")

</div>

Where do you declare the variable [color=#FF0000]results[/color] and [color=#FF0000]MyData[/color] thanks

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 11, 2013, 6:07pm UTC](https://forum.inductiveautomation.com/t/ack-all-from-external-button/6680/5 "2013-06-11T18:07:15Z")

</div>

With slightly less verbosity:

```auto
alarmEvents = system.alarm.queryStatus(state=["ActiveUnacked"])
alarmIds = [str(event.getId()) for event in alarmEvents]

system.alarm.acknowledge(alarmIds, "acked all from script")
```
