Update cookies preferences
Promotic

Object PmMap (Object with named values)

Description:
In this object it is possible to add and use named values (i.e. the dynamic properties) by script.
At the start (after being created by the Pm.CreatePmMap method) the object is empty and contains only built-in methods starting with map (e.g. mapLoadFromString).
Properties and methods:
Dynamic propertiesDynamic properties added by designer in the script.
The names must not contain spaces, special characters, diacritic characters (i.e. national dependent characters), must not begin with number or map characters.
mapAdd()Sets multiple values of selected object properties
mapGetValueAt()Returns a value of selected object property
mapSetSubmapAt()Returns an embedded Submap
mapSetValueAt()Sets the value of selected object property
mapLoadFromString()Creates properties with defined values in the object
mapSaveToString()Saves the content of the object into a text string
mapGetPropNames()Returns an array containing names of all dynamic properties
Note:
- The object can be created by the Pm.CreatePmMap method.
- This object is functional also in Web panels.
- The object can be used in both VBScript and JavaScript languages.


Creating property and setting value:
In this object it is possible to create new properties with given name and value (contrary to other objects).
New property is created by first write.
For example:
JavaScriptVBScriptSelect and copy to clipboard

var mMap = Pm.CreatePmMap();
mMap.xyz = 3.14;
In the mMap object, there is a new property "xyz" containing the 3.14 value. Assigning new value into this property only changes the value of this property.
Properties in this object can be created or set also by the mapLoadFromString or mapSetValueAt method.
Caution: In the Web panel that is written in the VBScript language it is not possible to create property just by assigning the value. In this case the mapSetValueAt method can be used.

Read property value:
JavaScriptVBScriptSelect and copy to clipboard

var val = mMap.xyz;

Property value in this object can also by read by the mapGetValueAt method.
Comparison of objects used for data storage:
The following object types can be used for holding values (of any data type). Each of these objects has certain advantages and disadvantages and the choice depends on the desired usage.
PmArray: This object contains values that are accessible by index into the array - it is possible to read any value at any time in this object. Reading and writing values is very fast, but adding is slow.
This object is functional only for JavaScript language. For the VBScript language the array is represented by Array data type.
PmMap: This object contains values that are addressed by name (text identifier). Value names represent object properties. The advanatege is the "clarity" of usage in the script code. The disadvantage is the inability to access the values in cycle by index.
PmBuffer: This object contains binary values in the data block. For reading/writing of individual value it is necessary to know its position (offset) in the data block and also the data type (size).

History:
Pm8.03.04: Allows to create new user properties in this (empty at the beginning) object. This is very handy if the designer needs to transfer multiple named values into some method.
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

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