To achieve calling this event for the specific variable, it is necessary to:
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 usage of this event is appropriate, for example, to filter written values.
The
pEvent.NewVal property is defined for read and write. If a new value is written into this parameter, then the value from the parameter is written as a matter of fact into the object variable (after ending this event).
Caution 1:
It is recommended to use this event only for
special cases. When this event is enabled, the values are written in a more complex way.
If the writing is invoked in the main thread then the event is triggered synchronously and the writing is also finished
synchronously.
If the writing is called from another thread (web, communication, the
PmaSequencer object) then the event is triggered
asynchronously, i.e. this event does not triggered the variable write command instantly, but later, after the active script is finished. The delayed asynchronous writing causes the variable to contain the original value even after the writing is reportedly complete, so if such value is then read (script, trends) it still contains the original value.
Caution 2:
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 !).