Skip to main content
Version: 8.1

Perspective - Alarm Status Table Scripting

This page details the various scripting, component, and extension functions available for Perspective's Alarm Status Table component.

Component Events​

The Perspective Event Types Reference page describes all the possible component event types for Perspective components. Not all component events support each Perspective component. The Component Events and Actions page shows how to configure events and actions on a Perspective component. Component scripting is handled separately and can be accessed from the Component menubar or by right clicking on the component.

Component Functions​

.refreshData()​

New in 8.1.18

  • Description
    • Refreshes the data on the Alarm Status Table.
  • Parameters
    • None
  • Return
    • Nothing

Extension Functions​

.filterAlarm​

New in 8.1.0

  • Description
    • Called for each event before it is displayed in the table, allowing you to hide or show each alarm event (row) in the table. Provides an opportunity to write a more complex filter than what's normally provided to the component. Return False to exclude an alarm event from the table.
  • Parameters
    • ComponentModelScriptWrapper.SafetyWrapper self- A reference to the component that is invoking this function.
    • PyAlarmEvent alarmEvent - The alarm event itself. Call alarmEvent.get('propertyName') to inspect properties on the event. Common properties: name, source, priority.
  • Return
    • Boolean - The function must return either a True or False for every alarm event in the table. True will show the alarm. False will hide the alarm.

Examples​

With the built-in PyAlarmEvent object all alarm event properties are accessible to this function, and can be used to help determine if any given event should appear on the table. Furthermore, Associated Data (also known as custom alarm properties) can be examined from the same event.

# Replace Property Name below with a the name of the property you wish to filter on.
if alarmEvent.get('Property Name'):
return True
# It's important that you return a False value for the events you don't want to see in the table.
else:
return False

You could also condense the code example above by using something like the following:

return "Low"== str(alarmEvent.get('priority'))

.filterShelvedAlarm​

New in 8.1.0

  • Description
    • Called for each event before it is displayed in the shelved tab of the table, allowing you to hide or show each alarm event (row) in the table. Return False to exclude a shelved alarm event from the table.
  • Parameters
    • ComponentModelScriptWrapper.SafetyWrapper self- A reference to the component that is invoking this function.
    • PyAlarmEvent shelvedAlarmEvent - The shelved alarm event. Call shelvedAlarmEvent.get('propertyName') to inspect properties on the event. Properties: sourcePath, shelvedBy, expires.
  • Return
    • Boolean - The function must return either a True or False for every alarm event in the table. True will show the alarm. False will hide the alarm.

Example​

Unlike the alarmEvent object, the shelvedAlarmEvent object may only inspect shelved alarm event properties.

# display only shelved alarms from a specific sourcePath:

source = shelvedAlarmEvent.get('sourcePath')
if source == 'prov:default:/tag:myTag/Mode:/alm:myAlarm':
return True
return False