Skip to main content
Version: 7.9

system.alarm.queryJournal

This function is used in Python Scripting.

Description

Queries the specified journal for historical alarm events. The result is a list of alarm events, which can be queried for individual properties. The result object also has a getDataset() function that can be used to convert the query results into a normal dataset, with the columns: EventId, Source, DisplayPath, EventTime, EventState, Priority, IsSystemEvent

Click here for more information on alarm properties.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.alarm.queryJournal(startDate, endDate, journalName, priority, state, path, source, displaypath, all_properties, any_properties, defined, includeData, includeSystem, isSystem)

Parameters

TypeParameterDescription
DatestartDateThe start of the time range to query. Defaults to 8 hours previous to now if omitted. Time range is inclusive.
DateendDateThe end of the time range to query. Defaults to "now" if omitted.
StringjournalNameThe journal name to query.
String[]priorityA list of possible priorities to match. Priorities can be specified by name or number, with the values: Diagnostic(0), Low(1), Medium(2), High(3), Critical(4).
String[]stateA list of the event state types to match. Valid values are "ClearUnacked", "ClearAcked", "ActiveUnacked", and "ActiveAcked".
String[]pathA list of possible source paths to search at. The wildcard "*" may be used.
String[]sourceA list of possible source paths to search at. The wildcard "*" may be used.
String[]displaypathA list of display paths to search at. Display paths are separated by "/", and if a path ends in "/*", everything below that path will be searched as well.
Object[][]all_propertiesA set of property conditions, all of which must be met for the condition to pass. This parameter is a list of tuples, in the form ("propName", "condition", value). Valid condition values: "=","!=","<","<=",">",">=". Only the first two conditions may be used for string values.
Object[][]any_propertiesA set of property conditions, any of which will cause the overall the condition to pass. This parameter is a list of tuples, in the form ("propName", "condition", value). Valid condition values: "=","!=","<","<=",">",">=". Only the first two conditions may be used for string values.
String[]definedA list of string property names, all of which must be present on an event for it to pass.
BooleanincludeDataWhether or not event data should be included in the return. If this parameter is false, and if there are no conditions specified on associated data, the properties table will not be queried.
BooleanincludeSystemSpecifies whether system events are included in the return.
BooleanisSystemSpecifies whether the returned event must or must not be a system event.

Returns

AlarmQueryResults - The AlarmQueryResults object is functionally a list of AlarmEvent objects. The AlarmQueryResults object has a built-in getDataset() function that will return a Standard Dataset containing the Event Id (UUID of the alarm), Source Path, Display Path, Event Time, State (as an integer), and Priority (as an integer).

Additionally, each AlarmEvent inside of the AlarmQueryResults object has several built-in methods to extract alarm information. More details on these methods can be found on the Alarm Event Properties Reference page.

Important

Each item in the resulting list is a separate alarm event: an alarm becoming active is one item, while the same alarm becoming acknowledged is a separate item. This differs from system.alarm.queryStatus() which groups each event into a single item.

Scope

All

Code Examples

Example #1
# This example shows the basic syntax for querying from the journal in a button's actionPerformed event, with a date range selector ("Range"), storing the results back to a table called "Table":

table = event.source.parent.getComponent("Table")
range= event.source.parent.getComponent("Range")

results = system.alarm.queryJournal(journalName="Journal", startDate=range.startDate, endDate=range.endDate)
table.data = results.getDataset()
Example #2
# This example extends the previous to only include non-acknowledged events of High or Critical severity, who have associated data called "Department", set to "maintenance". It also excludes system events (shelving notifications, etc):

table = event.source.parent.getComponent("Table")
range= event.source.parent.getComponent("Range")

results = system.alarm.queryJournal(journalName="Journal", startDate=range.startDate, endDate=range.endDate, state=['ActiveUnacked', 'ClearUnacked'], all_properties=[("Department","=","maintenance")], priority=["High", "Critical"], includeSystem=False)
table.data = results.getDataset()