onItemAfterWrite - event of object PmData

The event fires after writing into (the change of) the variable value defined on the Data page.
pMe(Object) Reference to the Promotic object where the event rises.
pEvent(Object) A referrence to object describing detailed information about the specific event.
pEvent.Item - (Object) The Var object containing the information about the variable, in which some writing (change) occurred
pEvent.OldVal - (Variant) Old value of the variable. The variable had this value before writing.

To achieve calling this event for the specific variable, it is necessary to enable the calling explicitly in the variable (see the configurator "ExtWriteAction > Data extension configuration: ExtWriteAction > Event "onItemAfterWrite""). There it is also defined if the event fires after each writing or after each change of the value.

If the fireing is enabled for each variable and writing into (the change of) all variables occurs at a time, the event fires for each variable separately!

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 when the variable changes.


The event fires only when the real writing is performed (e.g. object.Item(0)=3) into the variable - let's mark it A. But if the data binding (during the reading) to another variable B (in another object) is defined in the variable A and it is written into the variable B then the variable A doesn't know about the change and thus the event not fires (the variable A does know about the change only when it is read by someone - data binding is then "performed" - but the event not fires again !).

See also:
The following script in the onItemAfterWrite event dumps into the Debug_info item of the INFO system the information about the written value - it dumps the variable name where it was written, the index of the variable and an old and new value of the variable.
Pm.Debug "NewValue:" & pEvent.Item.Value
Pm.Debug "OldValue:" & pEvent.OldVal
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice