Ignition alarm page to display limited number of alarms

Hi all,

I am currently working on an ignition SCADA project. The client wants to display both active alarms and alarm log under different pages, and he also wants to display only 50 latest alarms (both active and cleared) on the alarm log page due to screen size limit.

I can filter the alarms for different alarm pages, but how do I limit it to display 50 alarms only?
I usually work it out via SQL and scripting if using FTview, but I think there should be a simple way to do it in Ignition.

Any suggestion is appreciated.

Jeff

The stock journal table is limited by dates, not occurrences. You’d have to roll your own journal to do this.

The query would be something like:

SELECT TOP 50 * FROM alarm_events
ORDER BY eventtime DESC

Thanks for the reply.
It seems that there’s no simple setting on the alarm table component to set the number of alarms to display.
I will go with SQL query.

I thought that’s what I said, but okay… :slight_smile:

Oh! And welcome to the forums… my manners slipped for a moment.

@Jordan, yes, you are right, SQL query is the only way to go, thanks for the advice. I thought Ignition can do better than FTview SE at this area.

Just a bit further discussion about the SQL query.

To display alarm log, I just need to poll all data from alarm_events table.

But to display only the current active alarms on alarm status banner, it will need have some filters.
I can filter the alarms by eventtype = 0, which is active alarms, but it displays whole bunch of duplicated alarms.
By looking at the non-filtered alarm list, it seems that whenever the alarm is activated, it will add one record to the alarm_events table, if the alarm is cleared, instead of modifying in the existing alarm record to flag it as cleared/acked, a new alarm record is added with flag as “20”/(bit.4 of eventflags) , cleared.
So when filtering the alarms, if the alarm is set to auto-reset and it was triggered and cleared automatically a couple of time in the last 2 hours, the current active alarm list will display the duplicated alarm messages.
What’s the better filter I can add to filter out the duplicated alarm messages to display just the latest alarm message of that particular alarm?

The common application of the journal is alarms over a time period, not the number of occurences. It’s neither better, nor worse, it just is. Dang, now I’m starting to sound like Yoda…

Or, you could use the alarm status table. :confused:

That said, if I recall, each alarm has its own eventid. This is untested, but you could use a subquery like:

SELECT source, eventid, max(eventtime) as eventtime, eventtype FROM alarm_events
group by source, eventid, eventtime, eventtype
order by eventtime desc

and then pick out the events you want.

1 Like

I get Error running query:
SQLQuery(query=SELECT TOP 10 * FROM alarm_events, database=DB)@5000ms
On: Popup.Root Container.Alarm Status Table.selectedAlarms
caused by GatewayException: (conn=60) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘10 * FROM alarm_events’ at line 1
caused by SQLSyntaxErrorException: (conn=60) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘10 * FROM alarm_events’ at line 1

Ignition v8.1.1 (b2020120808)
Java: Azul Systems, Inc. 11.0.7

Seams is not correct the syntax

TOP is a MSSQL thing. MySQL uses LIMIT

SELECT * 
FROM alarm_events
LIMIT 10
1 Like

I am doing the exact same thing. I already have my named query. Any idea how should I transfer its data to the alarm journal or alarm status table?

It’s not possible to do with the stock tables. You would have to make your own.

1 Like