Update cookies preferences
Promotic

onItemAfterWrite - event of the PmaData object

Description:
The event is triggered after writing into (the change of) the value of one variable defined on the "Data" tab.
Parameters:
pMe(Object) Reference to the PmaData object where the event rises.
pEvent(Object) Reference to an object describing detailed information about the specific event.
pEvent.Item - (Object) [for reading] The PmVar object containing the information about the variable, in which some writing (change) occurred
pEvent.OldVal - (Variant) [for reading] Old value of the variable. The variable had this value before writing.
pEvent.OldQuality - (Long) [for reading] Old quality of the variable. The variable had this quality before writing.
Note:
To achieve calling this event for the specific variable, it is necessary to:
- Create a data extension ExtWriteAction in the variable.
- enable the calling explicitly in the variable (see the "ExtWriteAction > Data extension ExtWriteAction > Event "onItemAfterWrite"" configurator).
There it is also specifies whether the event is triggered after each writing or after each change of the value.
 
If the triggering is enabled for each variable and writing into (the change of) all variables occurs at a time, then the event is triggered for each variable separately!
The The usage of this event is appropriate, for example, to inform and test the value for alarm purposes or for special actions that have to occur if the variable changes.

Caution:
The event is triggered only if the real writing is performed (e.g. object.Item(0).Value=3) into the variable - let's mark it A.
But if the data binding (on reading) to another variable B (in another object) is defined in the A variable and it is written into the B variable, then the A variable doesn't know about the change and therefore the event is not triggered (the A variable does know about the change only when it is read by someone - data binding is then "performed" - but the the event is not triggered again !).
See also:
Example:
The following script in the onItemAfterWrite event dumps the information about the written value into the Debug item of the INFO system - it dumps the name of the variable where it was written, the index of the variable and an old and new value of the variable.
JavaScriptVBScriptSelect and copy to clipboard

Pm.Debug("Name:" + pEvent.Item.Name);
Pm.Debug("Index:" + pEvent.Item.Index);
Pm.Debug("NewValue:" + pEvent.Item.Value);
Pm.Debug("OldValue:" + pEvent.OldVal);

History:
Pm9.00.18: New pEvent.OldQuality parameter contains the original quality of the variable before writing.
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

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