Use cases
Filter data using an SQL query to display specific data from the database.
- As text
- By using the String formatter and its relative placeholders:
sql_identifier
andsql_literal
.
FROM
clause. Specify the table name in the dynamic link to the BrowseName
of the table with an {0:sql_identifier}
placeholder in a string formatter.Use case: filter by time
Use the Time
or Timestamp
column that contains the date and time to filter data by time.
Use the sql_literal
literal in the placeholder of the string formatter. Consider using a temporary DateTime
variable.
SELECT * FROM {0:sql_identifier} WHERE Timestamp > {1:sql_literal}
SELECT * FROM {0:sql_identifier} WHERE Timestamp BETWEEN {1:sql_literal} AND {2:sql_literal}
Use the Timestamp column to create a time filter on a Logger. Use the Time column to filter alarm history.
Use case: filter by alarm severity
The Severity
column contains the value of the severity of an alarm. Use this column to filter various severities of an alarm grid or alarm history grid.
SELECT * FROM {0:sql_identifier} WHERE Severity = 1
SELECT * FROM {0:sql_identifier} WHERE Severity BETWEEN 1 AND 3
Use case: filter by alarm or variable
The ConditionName
column contains the name of the alarm. Filter archived alarms to obtain specific alarms. You can filter alarm names if they follow a specific pattern.
The condition can be used on the SourceName
column to filter by the input variable.
SELECT * FROM {0:sql_identifier} WHERE ConditionName = {1:sql_literal}
SELECT * FROM {0:sql_identifier} WHERE SourceName = {1:sql_literal}
SELECT * FROM {0:sql_identifier} WHERE ConditionName LIKE 'Exclusive%'
Use case: filtering Recorded Alarms
Export some columns of the logger.
SELECT "ActiveState_it-IT", "AckedState_it-IT", "ConfirmedState_it-IT", "ConditionName", "EnabledState_it-IT", "SourceName", "Time", "Message_it-IT", "Severity" FROM {0:sql_identifier}