Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Variables - page of object PmRoot

Description:
Definition of global variables and constants that can be accessed in scripts directly by their names.

The form of the page is common to more Promotic objects and hence the common description is stated in the PmObject > Data page description.

 
Global variables in this folder are obsolete and it is better to define the variables in the PmData object. Accessing the global variables is easy, but brings many disadvantages. For example these work only in the VBScript language, cannot be called in different thread (in the PmSequencer object), etc.
Buttons:
NewThe Variable window is opened where new variable can be added.
Multi newThe Multi items adding window is opened where any number of variables can be added.
EditThe Variable window is opened the marked variable can be edited.
DeleteRemoves the marked variable.
UpIt is possible to change the order of variables. By pressing the Up/Down button the marked item will be moved upward/downword in the list. The same effect can be achieved by pressing the key combination ALT+up key/down key.
DownIt is possible to change the order of variables. By pressing the Up/Down button the marked item will be moved upward/downword in the list. The same effect can be achieved by pressing the key combination ALT+up key/down key.
SortIf sorts variables in the alphabetical order by the variable name. The order of variables is changed. Be careful in cases when variables are accessed not by the name but by the index (order).
ExportIt is possible to export the data of items of this page
XML file - see Data export to the XML text file. Various export types to the XML file are described in Import/Export in the application editor.
ImportIt is possible to load (import) the data into this page.
Selection from OPC server - This item is available only in the PmOpcClientData obejct. It opens the "Browsing the OPC server address space" window. On the selected level, it is possible to select multiple variables (by using the Ctrl, or Shift key), that are then added into this page.
Note:
Contrary to variables in other objects, the variable data type in this object can be set to Constant. This constant is then available as read only from all scripts. The constant data type itself is then defined by the data type of the evaluated initialization expression (e.g. true, false, 0, 1000, 1.33, CDbl(20.6), "BoilerPlant1", etc.).
Example:
There is as defined global constant ccc and global variable vvv. There is the PmData object with Number1 and Number2 data items. The value of the constant ccc will be written into the Number1 item. The variable vvv will be filled with the value of the Number2 item and then increased by 1.
Dim oData
Set oData = pMe.Pm("/Data")
oData.Item("Number1").Value = ccc
vvv = oData.Item("Number2").Value
vvv = vvv + 1
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice