Promotic

How to use array of values in the PROMOTIC system

The PROMOTIC system allows to write algorithms in two scripting languages: JavaScript and VBScript. The array is used in a different way in each language.
This chapter describes the usage of arrays in both languages.

JavaScript

The array in this language is represented by the PmArray object. This object is optimized for PROMOTIC system usage and allows to use 1- and 2-dimensional array.
The JavaScript language has its own Array object, but it is not recommended to use this object in the PROMOTIC system.

The PmArray object can be created by the Pm.CreatePmArray method.

VBScript

The array in this language is a standard VBScript array, i.e. Array data type.
The VBScript array functions can be used in order to work with this array.

The array can be created by the Array method (for 1-dimensional array), or by means of the Dim statement (also for multi-dimensional array).

(Col,Row) - 2-dimensional array meaning an array of rows

When working with 2-dimensional arrays, the user defines the meaning of the 1st and the 2nd dimension.
In the PROMOTIC functions that receive or return an array of rows, the meaning of the dimensions is always in the order (Col,Row) i.e. (Column,Row).
It means that the first index represents the number or the number of columns and the second index represents the number or number of rows.
This approach is handy because the whole rows can be added, deleted or modified easily, because the individual items of each row are stored in a sequential memory area.
 
See for example PmArray.GetItem, PmArray.SetItem, Pm.CreatePmArray.

Some other PROMOTIC methods using arrays

Pm.StringSplit - Returns a 1-dimensional array of substrings
Pm.StringJoin - Returns a string created by merging the substrings contained in 1-dimensional array
Pm.FileCsvRead - Reading from the CSV file
Pm.FileCsvWrite - Writing into the CSV file
Pm.FileTextWrite - Saving the variable (or array of variables) into the text file
Pm.FindViewers - Returns the list of object viewers according to selected criteria
Pm.GetRtLangs - Returns the list of all national languages supported in the application
Pm.ArrayOper - Array operations
Pm.TransformValue - Transformation of the value


PmaData.GetVarArray - Creates an array of values from all object variables
PmaData.GetVarSubArray - Creates an array of values from object variables specified by index
PmaData.SetVarArray - Assignment of values from the values array to the object variables
PmaData.SetVarSubArray - Assignment of values array


PmaDataTable.GetArray - Creates an array of values from selected data items of the object
PmaDataTable.SetArray - Assignment of the array of values to the data items of the object


PmaTrendGroup.GetData - Returns the stored data
PmaTrendGroup.GetValueByTime - Returns a value (or more values) of a variable (more variables) by the specified time
PmaTrendGroup.SetValueByTime - Writing the value (more values) of a variable (more variables) by the specified time.


PmaAlarmGroup.GetHistoryData - Obtains the data from history of alarms
PmaAlarmGroup.GetStateData - Obtains the data from current state of alarms
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
 
- How to use array of values in the PROMOTIC system
 
 
- SVG
© MICROSYS, spol. s r.o.