Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Pm - method of object PmObject

Description:
The method returns a reference (value of Object data type) to the Promotic object located in the application tree.
Syntax:
Pm(sPath As String, [nAttr As Long]) As Object
Calling:
Set o = oObject.Pm(sPath)
Parameters:
sPath(String) Relative or absolute path to the Promotic object in the application tree (case sensitive text).

The path describes the location of the object in the tree structure. Each tree level adress is separated by the / character. The immersed Promotic object is referrenced by its name. The superior Promotic object is referrenced by .. characters. The immersed implementation subobject (other than PmObject type) is referrenced by # character, followed by the implementation subobject type definition (e.g. #vars). It means that, the # addressing leaves the Promotic application object tree (created by user) and starts to address the implementation subobjects of the PROMOTIC object. For example "/appdata/data/#vars/Temperature".

nAttr[optional] (Long) enables to change the behavior of the function.
0 (default) - default behavior.
1 - when referencing the non-existent object the global error in the INFO system won't be generated.
Note:

By this method it is possible to get the reference to the defined object relatively to the object over which the method is called. The full path (the absolute path) needn't be entered in the sPath parameter but the relative path can be entered. The relative path is entered without the initial slash (/) and if it is required to refer to the parent object, two points can be used (as it is customary for example by entering the relative path to files in the OS Windows).

If the path defined by the sPath parameter begins with the slash (/), the path is regarded as the absolute path, i.e. the path is defined relative to the root object of the application - relative to the PmRoot object.

 
Identifier #vars:The reference to Var object can also be done directly by extending the path of the Pm method using the #vars identifier. This identifier can be used in methods working with application object tree (e.g. for the Pm method), or for the PP binding in the application and in panels. For example the method Pm("/data/#vars/Temperature) returns the "Temperature" variable (Var) in the "data" object(PmData).
 
Identifier #ext: References to Data extensions objects in the Var variable can also be done directly by extending the path of the Pm method using the #ext identifier. This can be used in Pm method or in PP binding in application and in panels. For example the pMe.Pm method ("/data/#vars/Temperature/#ext/al") returns the data binding with al identifier (ExtAlarmAnalog) in the "Temperature" variable (Var) in the "data" object (PmData).
 
In order to create the Object type variable containing reference to Promotic object in the object tree or its implementation subobject. See also: #pragma variable x = PmObjectRef("path").
Example:
Getting the reference to the Promotic object by the absolute path:
Set o = oObject.Pm("/Boiler1/Temperature")
Getting the reference by the relative path. The object will be searched on the same level of the objects tree as the object over which the method is called:
Set o = oObject.Pm("../Temperature")
Getting the reference by the relative path. The object will be searched among subobjects of the object over which the method is called:
Set o = oObject.Pm("Temperature")
Getting the reference to the Var subobject of the PmData object:
Set oVar = pMe.Pm("/Boiler1/Data/#vars/Temperature")
Finding the existence of the object (possible error won't be generated in the INFO system):
If Not oObject.Pm("/Boiler1/Temperature", 1) Is Nothing Then ...
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice