Promotic
WikipediaLinkedInYoutubeTwitterFacebook

onDataReceive - event of object PmCommData

Description:
The event fires after receipt of data from communication.

The procedure of calling this event depends on the settings of the "onDataReceive" event configurator. It is recommended to use the "A = call for all registered variables (in this object and also in other PmData objects)" setting.

Parameters:
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.Items - (Array) The property is set for various objects depending on "onDataReceive" event configurator setup:
- "A = call for all registered variables (in this object and also in other PmData objects)".

Then each item of this array represents the "data extension ExtComm object" of the variable that is defined either in this PmCommData object or in another PmData object.

- "B = call only for variables defined in this object (obsolete)".

Then each item of this array represents the "variable object Var" that is defined in this PmCommData object. Variables in other PmData objects (having the ExtComm data extension) are not processed here.

In both cases if 10 data items are received simultaneously from communication, then the event is fired only once and there are these 10 items in the array.

pEvent.ErrorCount - (Long) The number of data items in the array pEvent.Items, that do not have the Quality property set to Good.
Note:
This event is not necessarily called simultaneously for all communicated variables. It is called based on the communication progress - for example if a message is received, containing only 5 variables, then the event is fired and these 5 variables will be in pEvent.Items, and if another message is received with additional variables, then the event is fired again, etc.
 
The event fires each time the system tries to get the values of the variables. Fires even if the whole communication procedure failed and no values were obtained - if so, the pEvent.ErrorCount value will be the same as 1+UBound(pEvent.Items).
 
Calling this event can also be emulated in the INFO system when this object is being viewed and the "Actions" button is pressed. See permission PmRoot > Permissions > InfoEdit.
Example:
The "onDataReceive" event configurator is set to "A = call for all registered variables (in this object and also in other PmData objects)". We will report following information about the received data items into the Debug_info item of the INFO system:
VBScriptSelect and copy to clipboard

Dim i, u
u = UBound(pEvent.Items)
Pm.Debug "COMM onDataReceive: Count=" & (u + 1) & ", ErrorCount=" & pEvent.ErrorCount
For i = 0 To u
  Pm.Debug "Name=" & pEvent.Items(i).Var.Name
  Pm.Debug "Value=" & pEvent.Items(i).Var.Value
  Pm.Debug "Quality=" & pEvent.Items(i).Var.Quality
  Pm.Debug "ItemId=" & pEvent.Items(i).ItemId
Next
PROMOTIC 9.0.0 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice