Promotic

CreatePmArray - method of the Pm object

Description:
Creates object of the PmArray type.
Syntax:
Array CreatePmArray([Long nDim], [Long nSize1], [Long nSize2])
Parameters:
nDim[optional] (Long) Specifies the type of created array.
0 (default) - An empty uninitialized PmArray object is created.
1 - Creating a 1-dimensional array.
2 - Creating a 2-dimensional array.
nSize1[optional] (Long) (default 0) Array size in the first dimension (0, 1, 2, ..., n) for 1 or 2-dimensional array.
nSize2[optional] (Long) (default 0) Array size in the second dimension (0, 1, 2, ..., n) for 2-dimensional array.
See (Col,Row) - 2-dimensional array meaning an array of rows.
Return value:
PmArray object for JavaScript or Array data type for VBScript.
Note:
In JavaScript panels of the PROMOTIC application it is not possible to use the standard arrays of the VBScript and JavaScript languages (see Language data types). In these panels, all properties and methods use the PmArray - see How to use array of values in the PROMOTIC system.

This method is functional also in Macro expression $.expr and in the onDraw event of the PmgCanvas object.
This method is also functional in Web panels.
Example1:
Creates and fills 1-dimensional array
JavaScriptSelect and copy to clipboard

var arr = Pm.CreatePmArray().Array1(10, 20, 30, 40);
// or
var arr = Pm.Array1(10, 20, 30, 40);
Example2:
Creates and fills 1-dimensional array
JavaScriptSelect and copy to clipboard

var arr = Pm.CreatePmArray(1, 4);
arr.SetItem(10, 0);
arr.SetItem(20, 1);
arr.SetItem(30, 2);
arr.SetItem(10, 3);
Example3:
Creates and fills 2-dimensional array
JavaScriptSelect and copy to clipboard

var arr = Pm.CreatePmArray(2, 2, 3);
arr.SetItem(11, 0, 0);
arr.SetItem(12, 1, 0);
arr.SetItem(21, 0, 1);
arr.SetItem(22, 1, 1);
arr.SetItem(31, 0, 2);
arr.SetItem(32, 1, 2);

History:
Pm9.00.18: New parameters nDim, nSize1 and nSize2, allowing direct creation of an array of defined type and size.
Pm8.02.00: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- CreatePmArray
 
 
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r.o.