Description:
The method returns object of the
PmVar type that represents one variable defined on the "
Data" tab.
Syntax:
Object ItemEx(Variant id, [Long nAttr])
Parameters:
id | (Variant) Specifies the variable. The value is:
- Name (String, case sensitive text, for example "d1") or
- Index (Long, zero-based index) |
nAttr | [optional] (Long) It allows to change the behavior of the method.
0 (default) - Default behavior (as the Item method).
|
---|
Note:
The
PmVar object contains information about the variable (value, name, index, etc.).
If the variable does not exist, then error value (
null for
JavaScript or
Nothing for
VBScript) is returned.
Nothing value can be tested by VBScript
Is operator.
The method returns only 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 the
GetVarExtensions method.
Example1:
JavaScriptVBScriptSelect and copy to clipboard
var oOpcGroup = pMe.Pm("/OpcClient/Group1");
var val = oOpcGroup.ItemEx(0).Value;
// Reading the value
oOpcGroup.ItemEx(0).Value = 2;
// Writing the value
Dim oOpcGroup
Set oOpcGroup = pMe.Pm("/OpcClient/Group1")
Dim val
val = oOpcGroup.ItemEx(0).Value
' Reading the value
oOpcGroup.ItemEx(0).Value = 2
' Writing the value
Example2:
Test whether the variable named "Temperature3" exists:
JavaScriptVBScriptSelect and copy to clipboard
var oOpcGroup = pMe.Pm("/OpcClient/Group1");
var oItem = oOpcGroup.ItemEx("Temperature3", 1);
if (!oItem)
{
// ... error
}
Dim oOpcGroup
Set oOpcGroup = pMe.Pm("/OpcClient/Group1")
Dim oItem
Set oItem = oOpcGroup.ItemEx("Temperature3", 1)
If oItem Is Nothing Then
' ... error
End If