Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Parameters of the Pmg object

Parameters of the Pmg object are text constants (created by designer) that can be created in any Pmg object.

Pmg object parameters are very similar to the parameters of Pma object.

If there are some Pmg object parameters and if the mouse cursor hovers over this Pmg object in the graphics editor then these parameters (including values) are displayed in the status bar of the graphics editor.

 
The parameter has its name and value:
The parameter name is a system name (no diacritics, no spaces, must start with a letter).
The parameter value can be any text string. Macro expression can be used for input (it is evaluated while the window is opening).
 
Parameter creation:
- Parameters of the PmgRoot object are defined in the "PmgRoot > Panel > Object parameters" configurator.
- Parameters for other Pmg objects are defined in the "PmgObject > Object > Object parameters" configurator.
 
Reading and using parameters:

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 parameter is mainly used for configuration of Pmg object data binding. In this case the Pmg object (compound or single) can have more data bindings defined using this parameters such way, that the configuration change of parameter value will change the references to items in this data bindings. Another possible usage of parameter is for text parametrization in PmgString, PmgButton, etc. objects.

 
Parameter value change:
- During application runtime the Pmg object parameter value cannot be changed in general - it is used as constant.

The exception are the parameters of the PmgRoot object. These parameters can be modified when the panel is opened (contrary to the parameters in other Pmg objects). Then, after the panel is open, these parameters are static and cannot be modified. The parameter values of panels that are being open can be entered in two ways:

- while calling the OpenView method in the sParams parameter or
Example: It is possible to open the panel for the first time with the value of 1, for the second time with value of 2 - and this way to display the panel for "BoilerPlant1" and the second time for "BoilerPlant2".

- in the development environment it is of course possible to modify the values of all Pmg objects (you can also add or remove parameters).

The main purpose of Pmg object parameters is related to creation of Pmg object interface. It is very easy to change the parameter value after copying the Pmg object, so it displays the data, for example, not for "Boiler1" but for "Boiler2". This way the Pmg object parameters make the creation of often used user Pmg objects in the graphics editor much easier.


The example of text parametrization:

in the PmgString object create parameter named, for example, BoilerNum, set the value to 1. In this object, fill in the "Value" configurator:

$.join("Temperature in boiler", $.par("BoilerNum"))

The resulting displayed text: Temperature in boiler 1


The example of data binding parametrization:

Let´s have following data in the application: "/Boiler1/Data" and "/Boiler2/Data" of the same PmaData type. Both objects contain predefined variable "Temperature. Additional two objects for displaying both temperatures are located in the /PanelBoiler panel. If another object is added in the future, e.g. Boiler3, the new object created just by copying the existing object should display the temperature of the new object.

Solution:

- In the object of the PmgString type (displaying the temperature) create parameter named, for example, BoilerNum, set the value to 1.
- In the "Value" configurator of this object create the "PP - Data binding to Pma object property" data binding. In data binding fill in:
- The "Object" configurator with the following text:

$.join("/Boiler", $.par("BoilerNum"), "/Data/#vars/Temperature")

- The "Property" configurator will be filled in autoaticaly with the Value text.

This way the Pmg object is configured properly. Now it is possible to copy the object and just by changing the parameter value BoilerNum to 2 in this copy, to let the Pmg object display the value of /Boiler2/Data/#vars/Temperature. Any time in the future it is possible to change the object parameter and thus change the target object of the displayed value.


The example of creating panel with parameter:

Let´s have following data in the application: "/Boiler1/Data" and "/Boiler2/Data" of the same PmaData type. Both objects contain predefined variable "Temperature. There is the /PanelBoiler panel that displays the temperature of "Boiler1" or of "Boiler2" (according to the open window parameters).

Solution:

- In the /PanelBoiler panel, in the PmgRoot object, create parameter named BoilerNum.
- Create a Pmg object, for example, PmgString (will display the temperature value). In the Value configurator create the "PP - Data binding to Pma object property" data binding. In the data binding fill in:
- The "Object" configurator with the following text:

$.join("/Boiler", $.par("BoilerNum"), "/Data/#vars/Temperature")

- The "Property" configurator will be filled in autoaticaly with the Value text.

This way the panel is filled in correctly. Now you just have to assure to open the panel always with the correct parameter. For example create another panel that will be used for opening the /PanelBoiler panel. Insert two buttons (PmgButton Pmg objects) into this panel. The first button will open the panel for "Boiler1", the second button will open the same panel but for "Boiler2". Into the event onButtonUp of the first button enter this script:

pMe.PmPanel.OpenView "/PanelBoiler", "", "par:BoilerNum=1;"

Into the same event of the second button insert similar script:

pMe.PmPanel.OpenView "/PanelBoiler", "", "par:BoilerNum=2;"

Launch the application and open the panel with buttons. By pressing the first button the window for "Boiler1" is opened, by pressing the second button the window for "Boiler2" is opened.


History:
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