# I want to create a more detailed Alarm Status Report in 7.9

**URL:** <https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [March 4, 2022, 11:12pm UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871 "2022-03-04T23:12:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cole\_Barthel](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Cole\_Barthel](https://forum.inductiveautomation.com/u/Cole_Barthel)\
**Post date:** [March 4, 2022, 11:12pm UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/1 "2022-03-04T23:12:39Z")

</div>

Long story short, my bosses want a more detailed Alarm Status table, and I am fairly new to this whole thing. I have taken the core training course and for the most part know all of the basics. They want more than just the “Active Duration” data, as it is not enough for them to calculate the downtime of each alarm. They would like to know the “Total Active Duration” of the alarms throughout the table, and then export the alarm data to excel.

I was originally thinking the way to do it is to add an addition script to the table that adds up the Active Duration data of each individual alarm and sums it up.

My question is, what is the best way to achieve this?

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [March 4, 2022, 11:53pm UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/2 "2022-03-04T23:53:06Z")

</div>

Something like that would work. You could also use a report or generate your data set through scripting and use `system.dataset.toExcel` I think they are all fine methods, though there may be some challenges if your table spans multiple pages and you go the report route.

Welcome to the forum!

---

<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:** [March 5, 2022, 4:05am UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/3 "2022-03-05T04:05:57Z")

</div>

I don’t believe the alarm status table has a view dataset that you can use, so you’ll most likely need to use the system.alarm.queryStatus scripting function to generate this dataset for you. From there you’ll be able to do the calcs you want to get the rest of the info you need

---

<div class="post-metadata">

**Author:** ![Cole\_Barthel](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Cole\_Barthel](https://forum.inductiveautomation.com/u/Cole_Barthel)\
**Post date:** [March 8, 2022, 4:30am UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/4 "2022-03-08T04:30:24Z")

</div>

I found a much more detailed alarm analysis template in the exchange that seems pleasing to the eye. I think I just need to figure out how to filter the alarms so they only show alarms with ‘displaypath’ equal to a string value from parameter ‘spiral\_id\_data’.  
I’m pretty sure I need to edit the expression binding for the query properties like the one in the picture I uploaded.

What should I add to the alarmByCountQuery binding to only display alarms with ‘displaypath’ = ‘Alarm Analysis.spiral\_id\_data’?

Please ask if you need any other information from me.

 ![alarmanalysistemplatesnapshot](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/748a8ae6e3de74cc27d650dac224a3c3e39d8843.png)  
 ![alarmsbycountquerysnapshot](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/7/0737ce49fe9a59c2489791a0f54dceee6973b1d2.png)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 8, 2022, 11:00pm UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/5 "2022-03-08T23:00:42Z")

</div>

You can definitely add that to the where clause on any of the queries on the template. If you add it to the “alarmsByCountQuery” it would look like this:

```auto
"SELECT " +  
"	a.displaypath, " + 
"	COUNT(*) cnt " + 
"FROM " +  
"	alarm_events a " +  
"WHERE " +  
"	a.eventtime " +  
" BETWEEN '" + dateFormat({Alarm Analysis.startDate}, "yyyy-MM-dd HH:mm:ss") + "' AND '" + dateFormat({Alarm Analysis.endDate}, "yyyy-MM-dd HH:mm:ss") + "' " + 
"	AND a.eventtype = 0 " +
"	AND a.displaypath = '" + escapeSQL({Alarm Analysis.spiral_id_data}) + "' " +  
"GROUP BY " +  
"	a.displaypath " + 
"ORDER BY " +  
"	cnt DESC, a.displaypath ASC " + 
"LIMIT " +  
{Alarm Analysis.Filters.Top.intValue},

```

The only problem is that will only return a single row. This query is the “Alarm by Frequency” pie chart and you will only get one wedge. However, you can apply that to any of the queries.

---

<div class="post-metadata">

**Author:** ![Cole\_Barthel](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Cole\_Barthel](https://forum.inductiveautomation.com/u/Cole_Barthel)\
**Post date:** [March 9, 2022, 10:18pm UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/6 "2022-03-09T22:18:00Z")

</div>

> [@Travis.Cox](#):
>
> `"	AND a.displaypath = '" + escapeSQL({Alarm Analysis.spiral_id_data}) + "' " + `

Thank you for the helpful information!

I added that little bit of code to most of all the queries, and like you said it comes back with one wedge.  
In order to get the rest of the data displayed in each graph, I switched a.displaypath in SELECT, GROUP BY, and ORDER BY to a.source. It seems to work great for my Spiral 1 (spiral\_id\_data), but seems to only display 1 alarm for Spiral 2 and 3 (spiral\_id\_data).

Why do Spiral 2 and 3 only display 1 alarm?

The alarm event query database

 ![alarmeventquerydatabasesnapshot](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e613eef818c694e359409adddc1b258c28575973.png)

The graphs after just adding the display path code

 ![analysisafterfilterdisplaypath](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/5/f51e48270f7c8e95780545ac832b5ea96c0bf558.png)

The template query after displaypath code

 ![queryafterfiltercode](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/e/2eb71d64e61bd5c12186088c8aa79de796882cb4.png)

I can only upload 3 media items here so Ill do another reply with the rest of the photos.

---

<div class="post-metadata">

**Author:** ![Cole\_Barthel](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Cole\_Barthel](https://forum.inductiveautomation.com/u/Cole_Barthel)\
**Post date:** [March 9, 2022, 10:18pm UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/7 "2022-03-09T22:18:43Z")

</div>

The Spiral 1 graphs after switching displaypath code to source

 ![spiral1aftersourceswitch](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f2999951ce60e2e6df6d047523596079cc7ee1d6.png)

The template query after displaypath to source code

 ![templatequeryaftersourceswitch](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/26f865eb961a8eaf206ec40c1c5df76d999ff0b3.png)

The Spiral 2 graphs after switching displaypath code to source. Notice spiral\_id\_data property says Spiral 2.

 ![spiral2aftersourceswitch](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/376fbddbe7444cd8d5ce3d7ac1f901976d0f67be.png)

---

<div class="post-metadata">

**Author:** ![Cole\_Barthel](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Cole\_Barthel](https://forum.inductiveautomation.com/u/Cole_Barthel)\
**Post date:** [March 9, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/8 "2022-03-09T22:19:14Z")

</div>

The alarm events database query to show that there are more Spiral 2 alarms

 ![spiral2alarms](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c2e6e8483b51991393aac7cd028b917a41167aff.png)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 10, 2022, 1:19am UTC](https://forum.inductiveautomation.com/t/i-want-to-create-a-more-detailed-alarm-status-report-in-7-9/56871/9 "2022-03-10T01:19:07Z")

</div>

The problem is that all of those alarm events have an eventtype = 1 for Spiral 2. The query is only looking for active alarms by eventtype = 0. You can either remove that part of the where clause or include it look for eventtype \<= 1. Depends on which types of alarms you want to show (active, clear, ack).
