Event Overview
Getting Started
Each tag has the option to have tag event scripts on it. When you edit a tag, you can navigate to the Tag Events section to see a list of all of the tag scripts. You can then select which event you would like to write a script for. You can even write a script for multiple events if you would like.Value Changed
The Value Changed event is fired whenever the value of this particular tag changes. This event has a variety of arguments available for use in the script:
String tagPath - The full path to the tag.
Object previousValue - The previous value. This is a qualified value, so it has value, quality, and timestamp properties.
Object currentValue - The current value. This is a qualified value, so it has value, quality, and timestamp properties.
Boolean initialChange - A boolean flag indicating whether this event is due to the first execution of the initial subscription.
Boolean missedEvents - A flag indicating that some events have been skipped due to an event overflow.
Image Removed
Tip |
---|
The currentValue and previousValue arguments are qualified values. This means that to get to the actual current value, it would look like currentValue.value. |
Quality Changed
The Quality Changed event is fired whenever the quality of this particular tag changes. Since tags use a 'qualified value', which include a value, quality, and timestamp, this script will fire whenever any of those change. This event has a variety of arguments available for use in the script:
String tagPath - The full path to the tag.
Object previousValue - The previous value. This is a qualified value, so it has value, quality, and timestamp properties.
Object currentValue - The current value. This is a qualified value, so it has value, quality, and timestamp properties.
Boolean initialChange - A boolean flag indicating whether this event is due to the first execution of the initial subscription.
Boolean missedEvents - A flag indicating that some events have been skipped due to an event overflow.
Alarm Active
The Alarm Active event fires whenever an alarm becomes active on the tag.This event has a variety of arguments available for use in the script:
String tagPath - The full path to the tag.
String alarmName - The name of the alarm. This does not include the full alarm path.
Object alarmEvent - The full alarm event object. The properties available to this object are:
- id
- source
- name
- priority
- displayPath
- displayPathOrSource (the display path if it is set, otherwise the source)
- state (the current state, active/cleared + acked/unacked)
- lastEventState (the last transition)
- cleared (a boolean if the alarm is currently cleared)
- acked (a boolean if the alarm is currently acknowledged)
- shelved (a boolean if the alarm is currently acknowledged)
- notes
String alarmPath - The full alarm path.
Boolean missedEvents - A flag indicating that some events have been skipped due to an event overflow.
Alarm Cleared
The Alarm Cleared event fires whenever an alarm becomes cleared on the tag.This event has a variety of arguments available for use in the script:
String tagPath - The full path to the tag.
String alarmName - The name of the alarm. This does not include the full alarm path.
Object alarmEvent - The full alarm event object. See the Alarm Active alarmEvent object for the full list of available properties.
String alarmPath - The full alarm path.
Boolean missedEvents - A flag indicating that some events have been skipped due to an event overflow.
Alarm Acknowledged
The Alarm Acknowledged event fires whenever an alarm event becomes acknowledged on the tag.This event has a variety of arguments available for use in the script:
String tagPath - The full path to the tag.
String alarmName - The name of the alarm. This does not include the full alarm path.
Object alarmEvent - The full alarm event object. See the Alarm Active alarmEvent object for the full list of available properties.
String alarmPath - The full alarm path.
String ackedBy - The full path to the user that acknowledged the alarm.
Boolean missedEvents - A flag indicating that some events have been skipped due to an event overflow.