Promotic

GetArray - method of the PmaDatabase object

Description:
Creates an array or matrix of values read from selected table columns.
The method reads all values from one or more table columns according to setting the vWhat parameter.
Syntax:
Array GetArray(String sType, Variant vWhat)
Parameters:
sType(String) Type of selected values in the table:
"col" - data from one or more table columns are returned (i.e. 1-dimensional array or matrix of data is created) depending on the value of the vWhat parameter.
"all" - Returns data of all table columns, i.e. all table is selected (i.e. 2-dimensional array is created). The vWhat value must be set to the value: null for JavaScript or Empty for VBScript.
vWhat(Variant) Specifies which columns values will be returned. The vWhat value must be a string, an integer or an array of integers.
If it is of the String type, then it is a column name or the string of column names separated by semicolon, for example, "col4;col5;col6".
If it is the integer, then vWhat>=0 means the index of the selected column (vWhat=0 means the first column, vWhat=-2 means the last column).
If vWhat is the array of integers, then these numbers specify indexes of table columns which data will be returned from.


"xxx" - vWhat is the text string specifying either the column name, for example col4 or the text string with column names separated by semicolon, for example "col4;col5;col6".
>=0 - integer >=0 means the index of the selected column (vWhat=0 means the first column).
-2 - The -2 value means that data from the last column are returned.
If vWhat is the array of integers, then these numbers specify indexes of table columns which data will be returned from.
array - If vWhat is the array of integers (for example vWhat=Array(0,2,6)), then numbers in the array specify indexes of table columns which data will be returned from.
Return value:
PmArray object for JavaScript or Array data type for VBScript.
Note:
The usage of this method can take even significant long time when getting the large volume of data from comprehensive tables (tens of thousands rows, ...), depending on the actual HW configuration of the computer. It is necessary to test it in this case.
Example1:
1-dimensional array that contains all values in the column named "variable1", is assigned to arr
JavaScriptVBScriptSelect and copy to clipboard

arr = oDatabase.GetArray("col", "variable1");
Example2:
1-dimensional array that contains all values from the third column (zero-based index), is assigned to arr
JavaScriptVBScriptSelect and copy to clipboard

arr = oDatabase.GetArray("col", 2);
Example3:
A matrix that contains in the first row all values in the column named "variable1" and in the second row all values in the column named "variable2", is assigned to arr
JavaScriptVBScriptSelect and copy to clipboard

arr = oDatabase.GetArray("col", "variable1;variable2");
Example4:
JavaScriptVBScriptSelect and copy to clipboard

var cols = Pm.Array1(0, 1, 2);
arr = oDatabase.GetArray("col", cols);
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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