How can I display the latest alarm on a PX page?

Baja Query Language (BQL) can be used to query the alarm database to find and display this for you

There are a number of ways of displaying this

One way would be creating a Report Widget:

  1. Open the "Report" palette and under "ReportWidgets" folder, drag a BoundTable onto the PX page
  2. Copy and paste the following into the ord of the above -
    • alarm:|bql:select Top 1 timestamp, sourceState, ackState, alarmData.sourceName, alarmClass, priority order by timestamp DESC
  3. Make any other settings you require to the widget
  4. You're done! You can change the BQL to display different alarm fields or show the top 10 alarms, change order etc. to get it showing exactly what you want

 

Another way is using a label that shows the latest alarm, modifying slightly the BQL from above:

  1. Drag a BoundLabel onto the PX page
  2. Copy and paste the following into the Bound Label Binding ord section of the above - 
    • alarm:|bql:select Top 1 timestamp, sourceState, ackState, alarmData.sourceName, alarmClass, priority order by timestamp DESC|cell:0,0
  3. Leave the "Text" option animated with the following bFormat
    • %.%
  4. This will return the "TimeStamp" of the latest alarm in a label (column "0")
  5. Create another label, this time with the following ord -
    • alarm:|bql:select Top 1 timestamp, sourceState, ackState, alarmData.sourceName, alarmClass, priority order by timestamp DESC|cell:3,0
  6. This will return the "Source Name" of the latest alarm in a label (column "3"). Basically, the first of the two numbers on the "cell" is used to select the "column" of the table to show on your label

 

See here an example with the table format on the top, and the 2 labels below