# Perspective alarm status table - get number of alarms

**URL:** <https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033>\
**Category:** Ignition\
**Created:** [April 29, 2022, 7:23am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033 "2022-04-29T07:23:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [April 29, 2022, 7:23am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033/1 "2022-04-29T07:23:42Z")

</div>

Is there any way to retrieve the number of alarms currently being shown in a perspective alarm status table? I have a simple alarm banner in a dock, which has no filtering (and no ability for the user to filter) - it just shows all the alarms for the relevant area based on a source filter passed in at runtime. I would like to set up an event script to close the alarm dock when the number of alarms shown in it goes from \> 0 to 0.

I’ve made it work by setting up a custom property which uses `system.alarm.queryStatus` and gets all the parameters for the query from the table, but I’d like to think there’s an easier way, since the alarm status table tells me “_n_ active alarms” in the header - but I can’t find anywhere in the properties that makes that value available to me.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 29, 2022, 7:44am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033/2 "2022-04-29T07:44:34Z")

</div>

If I understand properly, you have an alarm status table in a dock, and you want to hide it when it’s empty.

The `AlarmStatusTable` has a property that enables it to write back its contents to another property:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/7/5785d3d006c6d5643db937ab48cf8996c32e01a8.png)

You can set the `filter.results.enabled` property to true then use `filter.results.data` to see if there’s anything in your table.

---

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [April 30, 2022, 3:48am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033/3 "2022-04-30T03:48:58Z")

</div>

Ah, so I have to enable it. I see that the doc you linked warns of a performance decline when enabling this property. Any developers here able to give a little context as to how large a performance hit we’re talking about? What would be the more significant performance impact, enabling that property, or running the script below every time the “Active and Unacknowledged Alarms Count” tag from the gateway system tags changes?

```auto
#determine which alarm priorities to count, based on what is being shown in the alarm table
filteredPriorities = self.getChild("root").getChild("AlarmStatusTable").props.filters.active.priorities
priorities = []
for key, value in filteredPriorities.items():
	if value: priorities.append(key)
	
#determine which alarm states to count, based on what is being shown in the alarm table
filteredStates = self.getChild("root").getChild("AlarmStatusTable").props.filters.active.states
states = []
for key, value in filteredStates.items():
	if value: states.append(key)
	
#determine with alarm sources to query, based on what is being shown in the alarm table
sources = self.getChild("root").getChild("AlarmStatusTable").props.filters.active.conditions.source
	
#query alarms
alarmStatusInfo = system.alarm.queryStatus(priority=priorities, state=states, source=sources)
	
return len(alarmStatusInfo)

```

---

<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:** [April 30, 2022, 4:03am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033/4 "2022-04-30T04:03:55Z")

</div>

There’s probably a larger performance hit by calling system.alarm.queryStatus for every client that’s open than there is by writing the alarm info to that property. I guess it depends how many alarms you have active at a time

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 30, 2022, 8:32am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033/5 "2022-04-30T08:32:56Z")

</div>

I’ve been using this ‘write back’ method on several different tables and didn’t notice any significant performance hit.

---

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [May 4, 2022, 7:31am UTC](https://forum.inductiveautomation.com/t/perspective-alarm-status-table-get-number-of-alarms/59033/6 "2022-05-04T07:31:23Z")

</div>

Thanks everyone. I’ll go that route.
