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.
@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?
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