WhereClause property

Sets or returns a string that specifies the SQL WHERE condition used to retrieve information from the database configured to store historical alarm and event data. When the information is returned it is displayed in the Alarm and Event Log Viewer.
Read/write. String.
Syntax
object
.
WhereClause
[ = string]
where
object
— the name of an AlarmEventLogViewer object.
string
— SQL WHERE condition used to retrieve information from the database configured to store historical alarm and event data
Remarks
If all database records are being displayed, the property returns an empty string.
Setting the property to an empty string queries the database for all records.
Writing to the property causes the Alarm and Event Log Viewer to query the database for data matching the SQL WHERE condition and then display the results. When the property is modified, the Alarm and Event Log Viewer will display the text "(Custom)" in the
Filter List
located on the toolbar and in the
Filter
panel located on the status bar.
The property does not return an error for an invalid SQL WHERE condition (an error will be logged to FactoryTalk Diagnostics).
Values
For a list of field names that can be used in the SQL WHERE condition, see AllEvents database view.
Use the following guidelines when retrieving information from the database.
  • Equals
    • Enumeration:
      Priority = 5
    • Number:
      Severity = 500
    • String:
      ConditionName = N'HIHI'
      (N means Unicode)
  • Not equal to
    • Enumeration:
      Priority !=5
    • Number:
      Severity >= 500
    • String:
      ConditionName <> N'HIHI'
  • Contains
    • EventCategory LIKE N'%Level%'
  • AND, OR, and NOT
    • Priority = 5 And Not(EventCategory LIKE N’%Level%’) Or ConditionName <> N’HiHi’
Examples
  • Enumerated values
    : Use the constant listed for the field values (see AllEvents database view). For example, to query for all Urgent priority alarms:
    AlarmEventLogViewer1.WhereClause = "Priority = 8"
    To get the alarm state, you need to combine different types. For example, to query for all Active, Unacknowledged, and Urgent priority alarms:
    AlarmEventLogViewer1.WhereClause = "Active = 1 And Acked = 0 And Priority = 5"
  • String values
    : Enclose within single quotes, for example:
    AlarmEventLogViewer1.WhereClause = "AlarmClass = 'FTO'"
  • Date values
    : Enclose within single quotes, for example:
    AlarmEventLogViewer1.WhereClause = "EventTimeStamp >= '05/01/2008'"
  • Time and date values
    : Normalized to UTC (for example, GMT time zone).
  • Decimals and scientific notation
    : Permissible for numeric values.
For more information on building WHERE condition expressions, see your database documentation.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal