Promotic
WikipediaLinkedInYoutubeTwitterFacebook

GetPar - method of object PmgObject

Description:
Reading the value of the Pmg object parameter. If the 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])
Calling:
value = oItem.GetPar(sPar)
Parameters:
sPar(String) The name of the parameter (case sensitive text).
nAttr[optional] (Long) Additional attributes for detecting parameter.
0 (default) - Return Values is of the String type.
1 - Return Values is of the Long type.

If the value cannot be converted into an integer then the method returns NaN value - it can be tested by the Pm.IsValid method.

Return Values:
Returns a value of the parameter. If an error occures, it returns the Empty value.
Note:
The parameter can be read:
- in the script by the GetPar method.
- in configurators by the $.par macro expression (e.g. for data binding 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 this parameter is searched in its parents (in the immersed object) and finally it is searched in the PmgRoot object.

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

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

History:
Pm8.03.26: Generalization by parameter "nAttr". Now it is possible to set that the method returns the value as Long data type (otherwise always returned String).
Pm7.02.02: Created
PROMOTIC 9.0.7 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