Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Item - method of object PmaOpcClientGroup

Description:
The method enables an access to object of the PmVar type that represents one variable defined on the page Data.
Syntax:
Object Item(Variant id)
Calling:
Reading the value:
val = oOpcData.Item(id).Value
Writing the value:
oOpcData.Item(id).Value = val
Parameters:
id(Variant) Specifies the variable. The value is:
- Name (String, case sensitive text, for example "a1") or
- Index (Long, zero-based index)
Note:

The PmVar object includes information about the variable (value, name, index, etc.).

If the variable doesn't exist, then error value (null for JavaScript or Nothing pro VBScript) is returned. global error in the INFO system is generated. For variable existence testing, it is better to use the ItemEx method.

This method enables access only to variables (with corresponding data extension) that are created directly in this object (own variables). In fact also other variables from PmaData objects are registered into this object - those that have corresponding data extension configured with path to this object. All data extensions registered in this object can be accessed by method GetVarExtensions.

Example1:
Method Item returns object of the PmVar type. In this case this object has the following properties Value, TimeStamp and Quality that can be, for example, find out as follows:
JavaScriptVBScriptSelect and copy to clipboard

var val = oOpcData.Item(0).Value;
var tim = oOpcData.Item(0).TimeStamp;
var qual = oOpcData.Item(0).Quality;
Example2:
Some OPC servers (for Simatic, Schneider, Bernecker&Reiner ..) can transfer a data array (Array) in one data item (the common limitation is that all data array items must be of the same data type). If it is necessary to receive/send such data as well, then the "Data type" configurator has to be set to Variant data type for the variable (this is disabled in PmRtFree - Free runtime license).

Example see Data vector transfer

PROMOTIC 9.0.6 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