Retrieve logged event data
- Last UpdatedMar 07, 2025
- 2 minute read
When an event is detected, the event system logs the following into the EventHistory table: 1) the name of the event tag to which the criteria is associated; 2) the date/time stamp of the event occurrence; 3) the time the event is detected, and 4) the detection criteria information.
The detection criteria information, shown in the Edge column, is as follows:
|
Value |
Description |
|---|---|
|
0 |
Trailing Edge Detection (SQL Detectors) |
|
1 |
Leading Edge Detection (SQL Detectors) |
|
2 |
Detection on Both Edges (SQL Detectors) |
|
3 |
No Edge Detection (SQL Detectors) |
|
4 |
Schedule Detection |
|
5 |
External Detection |
If a snapshot action was configured for the event, the snapshot data is logged between the SnapshotTag table and the snapshot table for the tag type (for example, the AnalogSnapshot table). If a summary action is configured for the event, the aggregated data is stored in the SummaryHistory and SummaryData tables.
To view the event history, perform a query on EventHistory table. For example, an event tag, "EventTag1" detects when the value of "ReactLevel" was equal to 2000. The query to retrieve the event history on January 1, 2001, between 12:36 p.m. and 12:41 p.m. is:
SELECT * FROM EventHistory
WHERE TagName = 'EventTag1'
AND DateTime >= 'Jan 1 2001 12:36 PM'
AND DateTime <= 'Jan 1 2001 12:41 PM'
To view action snapshot information for an event tag (no wildcards allowed), use the v_EventSnapshot view and specify the name of the event tag as the event in the WHERE clause. For example:
SELECT * FROM v_EventSnapshot
WHERE Event = 'EventTag1'
This query returns the name of the event tag, the time of the event occurrence, and the detection time, as well as the name, value, and quality for each tag in the snapshot. One row is returned for each tag value.