# Displaying Alarm Count

**URL:** <https://forum.inductiveautomation.com/t/displaying-alarm-count/15443>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [September 22, 2017, 2:17pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443 "2017-09-22T14:17:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bprice](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bprice/32/83520_2.png) [@bprice](https://forum.inductiveautomation.com/u/bprice)\
**Post date:** [September 22, 2017, 2:17pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/1 "2017-09-22T14:17:46Z")

</div>

I am trying to display a number of alarms that are active. However, I am trying to display certain alarms. I have the alarms that I am wanting to display in a group called “Spray Status”. Is there a way to display how many alarms are active in that group?

---

<div class="post-metadata">

**Author:** ![brandon1](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@brandon1](https://forum.inductiveautomation.com/u/brandon1)\
**Post date:** [September 22, 2017, 4:15pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/2 "2017-09-22T16:15:13Z")

</div>

Try this:

```auto
properties = [("Group","=","Spray Status")]
tags = system.alarm.queryStatus(source=["*"],all_properties=properties)
print len(tags)

```

Please note that this assumes you have associated data configured on those ‘certain’ alarms named **‘Group’**. If this is not the case just change the first element of the tuple list named properties.  
Also note that if the alarms are already active in the system and you have added the associated data **_after_** they have went into alarm, they will not return in this query.  
Hope this helps

---

<div class="post-metadata">

**Author:** ![paul.bouillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.bouillon/32/7980_2.png) [@paul.bouillon](https://forum.inductiveautomation.com/u/paul.bouillon)\
**Post date:** [August 15, 2018, 9:17pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/3 "2018-08-15T21:17:41Z")

</div>

is there any way to bind components to the alarm count? not seeing any intuitive way of seeing alarm counts in real time other than by using ‘runscript’

---

<div class="post-metadata">

**Author:** ![R.Alamsha](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@R.Alamsha](https://forum.inductiveautomation.com/u/R.Alamsha)\
**Post date:** [August 16, 2018, 4:35am UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/4 "2018-08-16T04:35:50Z")

</div>

> [@paul.bouillon](#):
>
> not seeing any intuitive way of seeing alarm counts in real time other than by using 'runscript'

Download, restore and play with this IA official demo project. You will find almost every Ignition feature and functionality implemented here.

Ignition Demo Project Gateway Backup - 34 MB.

> **[Extra Ignition Materials | Inductive Automation](https://inductiveautomation.com/downloads/extra-material)**
>
> Here you can download a copy of the Ignition Demo Project gateway backup file, as well as an assortment of extras,
> from new components up to complete projects.

**The best tools to master Ignition are:**

1. Demo project
2. IA University
3. User manual
4. Cloud template browser in designer under tools menu
5. Forum search.
6. Ignition SDK.

---

<div class="post-metadata">

**Author:** ![paul.bouillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.bouillon/32/7980_2.png) [@paul.bouillon](https://forum.inductiveautomation.com/u/paul.bouillon)\
**Post date:** [August 20, 2018, 5:30pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/5 "2018-08-20T17:30:36Z")

</div>

Not seeing anywhere in the demo that you can get any sort of polled/filtered alarm counts… can you be more specific? I’m aware that tags are automatically generated on the gateway for alarm metadata for each provider – but I don’t really want to create a separate provider for each grouping count required…  
I’m aware that something of this sort can be accomplished with event-driven scripting – but was hoping for something polled/bindable…

Thanks

---

<div class="post-metadata">

**Author:** ![R.Alamsha](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@R.Alamsha](https://forum.inductiveautomation.com/u/R.Alamsha)\
**Post date:** [August 20, 2018, 11:47pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/6 "2018-08-20T23:47:38Z")

</div>

> [@paul.bouillon](#):
>
> Not seeing anywhere in the demo that you can get any sort of polled/filtered alarm counts...

Sorry for the confusion. You can find the Alarm Count template under:  
"Tools/Cloud Template Browser/Alarms". Also the Alarm Analysis template in Demo project has a lot of information.  
...............................

I found a better one. If you create a new project , you will find alarm count label under templates.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7115af967893796d3524d799435e843a312d3011.png)

---

<div class="post-metadata">

**Author:** ![paul.bouillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.bouillon/32/7980_2.png) [@paul.bouillon](https://forum.inductiveautomation.com/u/paul.bouillon)\
**Post date:** [August 31, 2018, 3:15am UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/7 "2018-08-31T03:15:42Z")

</div>

Right… so that basically uses that ‘runscript’ method to determine the alarm counts within the template instance:

```auto
if({Alarm Count Label.states} = "", 

	0,

	toInt(runScript("len(system.alarm.queryStatus(state=[" + 
	left({Alarm Count Label.states}, len({Alarm Count Label.states}) - 1) +
	"]))", {Alarm Count Label.UpdateRate}))
)

```

but at least this is bindable 🙂, and could be adapted to filter by tag folder/other sort of grouping. Perhaps it would be more efficient to create a few expression tags that utilize this, so that it is executed at the gateway once, rather than having each individual client execute it…  
Wishing that the alarm info aggregate functions were more advanced than just the “isAlarmActive()”.  
That “Alarm Analysis” template is pretty awesome though 🙂

---

<div class="post-metadata">

**Author:** ![R.Alamsha](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@R.Alamsha](https://forum.inductiveautomation.com/u/R.Alamsha)\
**Post date:** [September 4, 2018, 1:21pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/8 "2018-09-04T13:21:15Z")

</div>

> [@paul.bouillon](#):
>
> Right... so that basically uses that 'runscript' method to determine the alarm counts within the template instance:

Check out this one.

> [@Alarm active counter?](http://forum.inductiveautomation.com/t/alarm-active-counter/19515/2):
>
> Not sure if this what you are looking for. But i think, you can tweak and customize it to suit your requirement. This Alarm counter template can filter any string in the "Template properties/Displaypath" filter and can display the filtered alarms count. This is case insensitive. You can cross check by filtering Alarms in the "Alarm status table/Display Path Filter" and copy/paste the same string into this template's filter. Note: "Alarm status table/Display Path Filter" is case sensitive. […

---

<div class="post-metadata">

**Author:** ![martin.nelkie](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@martin.nelkie](https://forum.inductiveautomation.com/u/martin.nelkie)\
**Post date:** [January 30, 2019, 5:56pm UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/9 "2019-01-30T17:56:59Z")

</div>

I’m new to ignition. I want to change the alarm count based upon what page the user is on. I was planning to do this by sorting the alarm count by tag path or tag source using a client tag which changes the client tag when the user uses the navigation buttons. I keep getting a syntax error when implementing the code, I have tried multiple variations of the following to attempt to figure out the syntax.  
This works when typing in the actual tagpath Source=[’_’+‘TagPath’+’_’] or Source=[‘_TagPath_’]

Source=[’_’+ system.tag.read([Client]Disp\_Path) +’_’]  
Source=[’_’+ {[Client]Disp\_Path} +’_’]

if({Alarm Count Label.states} = “”,

```
0,

toInt(runScript("len(system.alarm.queryStatus( Source=['*'+ {[Client]Disp_Path} +'*'], state=[" + 
left({Alarm Count Label.states}, len({Alarm Count Label.states}) - 1) +
"]))", {Alarm Count Label.UpdateRate}))

```

)

Thank you,  
Martin

---

<div class="post-metadata">

**Author:** ![Abiodun.Martins](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@Abiodun.Martins](https://forum.inductiveautomation.com/u/Abiodun.Martins)\
**Post date:** [April 29, 2020, 9:01am UTC](https://forum.inductiveautomation.com/t/displaying-alarm-count/15443/10 "2020-04-29T09:01:06Z")

</div>

Good morning which of the answers was appropriate for what you needed, to add to my knowledge please?
