Promotic

GetPar - method of the PmgObject object

Description:
Reading the value of the Pmg object parameter.
If this parameter is not present in this object, then the parents of the object are searched for it and if not found the search continues up to the PmgRoot object.
Syntax:
Variant GetPar(String sPar, [Long nAttr])
Parameters:
sPar(String) The parametr name (case sensitive text).
nAttr[optional] (Long) Additional attributes for detecting parameter.
0 (default) - Return value is of the String type.
1 - Return value is of the Long type.
If the value cannot be converted into an integer then the method returns the NaN value - it can be tested by the Pm.IsValid method.
Return value:
Returns a value of the parameter.
If an error occures, then the method returns: null for JavaScript or Empty for VBScript (it can be tested by the Pm.IsValid method).
Note:
The parameter can be read:
- in the script by the GetPar method.
- in configurators by the $.par macro expression (e.g. for data bindings definition.

Both approaches read parameter the cascade way (bubbling), i.e. if the object (in which the macro is used), does not have this parameter, then the parameter is searched in its parents (in the immersed object) and finally it is searched in the PmgRoot object.

The method is functional also in the Web panel.
Example:
Reading the value of the abc parameter. This parameter can be defined in the Pmg object oObject or in its parents.
JavaScriptVBScriptSelect and copy to clipboard

var oObject = pMe.Items("/Panel0");
var x = oObject.GetPar("abc");

History:
Pm9.00.14: (Revision 1) Fixed bug: Parameter evaluation in embedded graphic objects
Pm8.03.26: Generalization by the nAttr parameter. Now it is possible to enter that the method returns the value as Long data type (otherwise always returned String).
Pm8.02.03: by the GetPar method; only the first parameter was accessible.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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