Point.OnAlarm (statement)

Syntax Point.OnAlarm [cond1 [ , cond2 [ , cond3 [ , cond4]]]]
Description To request the point's value when its alarm state changes. If no parameters are specified, the value will be returned whenever the alarm state changes. The four optional parameters can be used to restrict which alarm conditions will be reported to the application.
Comments Call GetNext to obtain the next value of the point. Only one of the OnChange , OnAlarm , OnTimed or OnAlarmAck requests may be active at a time. Optional Parameters
Value Description
CP_ALARM Send the value whenever the point changes into or out of an Alarm (Hi or Low) state.
CP_WARNING Send the value whenever the point changes into or out of a Warning (Hi or Low) or Alarm (Hi or Low) state.
CP_ALARM_HIGH Send the value whenever the point changes into or out of an Alarm High state.
CP_ALARM_LOW Send the value whenever the point changes into or out of an Alarm Low state.
CP_WARNING_HIGH Send the value whenever the point changes into or out of a Warning High or Alarm High state.
CP_WARNING_LOW Send the value whenever the point changes into or out of a Warning Low or Alarm Low state.
Example
Sub Main()
   Dim MyPoint as new Point
   MyPoint.Id = "TANK_LEVEL"
   MyPoint.OnAlarm
Top:
   MyPoint.GetNext
   if MyPoint.State = CP_ALARM_HIGH then
      MsgBox "Alarm High"
   elseif MyPoint.State = CP_ALARM_LOW then
      MsgBox "Alarm Low"
   elseif MyPoint.State = CP_WARNING_HIGH then
      MsgBox "Warning High"
   elseif MyPoint.State = CP_WARNING_LOW then
      MsgBox "Warning Low"
   elseif MyPoint.State = CP_UNAVAILABLE then
      MsgBox "Unavailable"
   else
      MsgBox "Normal"
   end if
   goto top
End Sub
See Also Point.GetNext (method); Point.Cancel (method); Point.OnAlarmAck (method).
Notes

The point value is sent when the point goes to warning or alarm state (based on the selected value), and then point value is sent again when the point goes back to normal state.

Due to a current limitation, selecting ALARM_HIGH and WARNING_LOW , for example, will return the point for all alarm and warning states. In other words, the High and Low end up applying to both the Alarm and Warning.