Point.OnAlarm (method)

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 an Alarm (Hi or Low) State
CP_WARNING Send the value whenever the point changes into a Warning (Hi or Low) State
CP_ALARM_HIGH Send the value whenever the point changes into an Alarm High State.
CP_ALARM_LOW Send the value whenever the point changes into an Alarm Low State.
CP_WARNING_HIGH Send the value whenever the point changes into a Warning High State.
CP_WARNING_LOW Send the value whenever the point changes into a Warning 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).
Note 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.