Promotic

onDataReceive - event of the PmaOpcDaClientGroup object

Description:
The event is triggered after the data receipt from the OPC server.
The triggering procedure of this event depends on the setup of the ""onDataReceive" event" configurator. It is recommended to use the "A = call the event for all registered variables (in this object and also in other PmaData objects)" setting.
Parameters:
pMe(Object) Reference to the PmaOpcDaClientGroup object where the event rises.
pEvent(Object) Reference to object describing detailed information about the specific event.
pEvent.Items - (Array) [for reading] The property is set only if the ""onDataReceive" event" configurator is set to:
- "A = call the event for all registered variables (in this object and also in other PmaData objects)".
Then each item of this array represents the "data extension ExtOpcDa object" of the variable that is defined either in the PmaOpcDaClientGroup object or in another PmaData object.
- "B = calling for the whole group of received variables - only for variables defined in this object (obsolete)".
Then each item of this array represents the PmVar object that is defined in the PmaOpcDaClientGroup object. Variables in other PmaData objects (that have the ExtOpcDa data extension) are not processed here.

In both cases, if for example 10 data items are simultaneously received from the OPC server then the event is triggered only once and there are these 10 items in the array.
pEvent.VarName - (String) [for reading] Data item name. The property is set only if the ""onDataReceive" event" configurator is set to "C = calling for each variable separately - only for variables defined in this object (obsolete)".
For example if 10 data items are received from the OPC server, then the event is triggered for each item and the name of the item is in the pEvent.VarName property.
pEvent.Reason - (Long) [for reading] Reason of the receipt.
0 - Receipt from the automatic update (only if the "Refresh from server at server change" configurator is checked).
1 - After calling the Read method.
2 - After calling the Refresh method.
Note:
Triggering of this event can also be emulated in the INFO system when this object is being viewed and the "Actions" button is pressed. See "PmaRoot > Permissions > InfoEdit" permission.
See also:
Example:
The ""onDataReceive" event" configurator is set to "A = call the event for all registered variables (in this object and also in other PmaData objects)".
We will report following information about the received data items into the Debug item of the INFO system:
JavaScriptVBScriptSelect and copy to clipboard

var aItems = pEvent.Items;
var nItems = aItems.GetSize(1);
Pm.Debug("OPC onDataReceive: Size=" + nItems + ", Reason=" + pEvent.Reason);

var i;
for (i = 0; i < nItems; i++)
{
Pm.Debug("Name=" + aItems.GetItem(i).Var.Name);
Pm.Debug("Value=" + aItems.GetItem(i).Var.Value);
Pm.Debug("Quality=" + aItems.GetItem(i).Var.Quality);
Pm.Debug("ItemId=" + aItems.GetItem(i).ItemId);
}
PROMOTIC 9.0.24 SCADA system documentation MICROSYS, spol. s r.o.

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