I’m trying to use SQL queries to gather statistics from the alarm_events table, such as the number of occurrences and duration for certain alarm types. However, I’m running into confusion regarding the structure of this table and how to properly interpret and filter the records.
Important restriction:
I cannot use Ignition’s built-in scripting functions; I need to read and process the data purely via SQL, because I am integrating it with other data sources for visualization in Tableau. This means I need a method/logic that works directly on the database.
Questions and Observations:
-
The alarm_events table appears quite complex; there can be several records for the same time period, and it’s unclear how to distinguish the meaning or lifecycle of each entry—especially with the eventtype field, which isn't fully explained in the official documentation.
-
I tried filtering only eventtype = 0 to find active alarms, but this results in a large number of records, and they don’t seem to match what I get from querying the alarm table (for either active or inactive alarms). For example, I see lots of eventtype = 0 rows for the same alarm, but nothing corresponding in the alarm table.
Sample records:
id | eventid | source | displaypath | priority | eventtype | eventflags | eventtime |
---|---|---|---|---|---|---|---|
2566086 | 5e6ca4f2-e42f-4d3a-89cf-29b4a7091fb8 | prov:PSY_18T_1_SCA:/tag:PLCALARMS/PLC1205_04/Alarm:/alm:Alarm | 1# Outdoor Air Handler Overcurrent | 3 | 0 | 0 | 2025-07-23 15:00:59.423 |
2566080 | 52d3a024-c2a0-4bff-8f6c-b22ad5f3e3ef | prov:PSY_18T_1_SCA:/tag:PLCALARMS/PLC1205_04/Alarm:/alm:Alarm | 1# Outdoor Air Handler Overcurrent | 3 | 1 | 16 | 2025-07-23 15:00:22.400 |
2562886 | 52d3a024-c2a0-4bff-8f6c-b22ad5f3e3ef | prov:PSY_18T_1_SCA:/tag:PLCALARMS/PLC1205_04/Alarm:/alm:Alarm | 1# Outdoor Air Handler Overcurrent | 3 | 0 | 0 | 2025-07-23 10:33:07.957 |
My questions are:
-
What does eventtype actually denote (e.g., what do 0, 1, 2 mean and how should they be interpreted)?
-
In the above example, does the latest eventtype = 0 entry indicate that the alarm is still active? In reality, there is no such ongoing alarm, and nothing appears in the alarm table for this event—neither active nor inactive.
-
What is the recommended best practice to count occurrences and durations for a certain type of alarm using this table strictly via SQL? Are there any sample queries or documentation?
-
How are the records above—especially those sharing the same eventid—related, and how can I reconstruct the alarm lifecycle or determine the active status?
Any advice, insights, or references to documentation (official or unofficial) about analyzing the alarm_events table would be greatly appreciated!
Thanks in advance!