Promotic

onStateChange - event of the PmaAlarmGroup object

Description:
The event is triggered when alarm item state change.
Parameters:
pMe(Object) Reference to the PmaAlarmGroup object where the event rises.
pEvent(Object) Reference to the object describing detailed information about the specific event.
pEvent.Item - (Object) [for reading] The reference to the alarm item (to the PmAlarmItem object) that was changed.
pEvent.Action - (Long) [for reading] Indication of the change type
0 - alarm was activated (see PmAlarmItem.Activate method)
1 - alarm was inactivated (see PmAlarmItem.Inactivate method)
2 - alarm was acknowledged (see PmAlarmItem.Acknowledge method)
3 - alarm has been changed automatically by the system to NEW non-initialized inactive acknowledged (green) alarm. See the "Change inactive acknowledged (green) CEASED to NEW non-initialized alarms in [s] (-1=never)" configurator.
pEvent.Context - (Object) [for reading] The reference to the object containing additional information about the user, that executed the action followed by triggering this event. The creation and termination of the alarm is always done by the local user. The alarm acknowledgment can be executed both by local and network application user (e.g. from the Web). The user info can be used, for example, for enabling/disabling the action (if possible), or for entering the user info into the alarms.
pEvent.Context.User - The reference to the PmUser object, containing detailed information about the user (local or network), that executed the action that triggered this event.
Caution! In order to keep the subobject User value trustworthy it is necessary to exclude the pseudo-groups $ANY and $ANY_NET from the appropriate "WebRead" permission (i.e. to ensure that the user is logged in when opening the Web pages).
pEvent.Context.Language - Returns the information about the national language. Language is determined with a text identifier, e.g. "en", "de", "ru" etc. - see Fully supported languages in the PROMOTIC system. See the "PmaRoot > Application > Main language of runtime" configurator.
See also:
Example:
We will write every change of each item into the Debug item of the INFO system:
JavaScriptVBScriptSelect and copy to clipboard

var sAction;
switch (pEvent.Action)
{
case 0:
sAction = "ACTIVATE";
break;
case 1:
sAction = "INACTIVATE";
break;
case 2:
sAction = "ACKNOWLEDGE";
break;
default:
sAction = "??";
break;
}

Pm.Debug("Event onStateChange:");
Pm.Debug("Action=" + sAction);
Pm.Debug("Description=" + pEvent.Item.Description);
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.