ItemEx - method of the PmaData object
Description:
The method enables an access to 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 | (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 doesn't exist, then error value (null for JavaScript or Nothing pro VBScript) is returned. Nothing value can be tested by VBScript Is operator.
Identifier #vars: The reference to
PmVar object can also be done directly by extending the path of the
Pm method by means of the
#vars identifier. This identifier can be used e.g. in the
Pm method, or for the PP data binding
in the application and
in panels. For example the method
Pm("/data/#vars/Temperature) returns the "Temperature" variable (
PmVar object) in the
data object (
PmaData object).
Identifier #ext: References to
Data extensions objects in the
PmVar variable can also be done directly by extending the path of the
Pm method using the
#ext identifier. This can be used in the
Pm method or in PP binding
in the application and
in panels. For example the method
pMe.
Pm("/data/#vars/Temperature/#ext/al") returns the data extension with
al identifier (
ExtAlarmAnalog) in the "Temperature" variable (
PmVar) in the
data object (
PmaData object).
Example1:
JavaScriptVBScriptSelect and copy to clipboard
var oData = pMe.Pm("/Data");
var oItemEx = oData.ItemEx(0); //Access to the object that represents the variable
var value = oItemEx.Value; //Reading the value
oItemEx.Value = 8; //Writing the value
Dim oData, oItemEx
Set oData = pMe.Pm("/Data")
Set oItemEx = oData.ItemEx(0) 'Access to the object that represents the variable
Dim value
value = oItemEx.Value 'Reading the value
oItemEx.Value = 8 'Writing the value
Example2:
Test whether the variable named "Temperature3" exists:
JavaScriptVBScriptSelect and copy to clipboard
var oData = pMe.Pm("/Data");
var oItem = oData.ItemEx("Temperature3", 1);
if (!oItem)
//...
Dim oData
Set oData = pMe.Pm("/Data")
Dim oItem
Set oItem = oData.ItemEx("Temperature3", 1)
If oItem Is Nothing Then
'...
End If