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

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?

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!

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

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.


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:

"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.

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

The graphs after just adding the display path code

The template query after displaypath code

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

The Spiral 1 graphs after switching displaypath code to source

The template query after displaypath to source code

The Spiral 2 graphs after switching displaypath code to source. Notice spiral_id_data property says Spiral 2.

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

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).