Promotic

SetArray - method of the PmaDataTable object

Description:
Assignment of the array of values (of the Array type) to the data items of the object.
Syntax:
Boolean SetArray(String sType, Variant index, Array aArray)
Parameters:
sType(String) Type of selected values in the table:
"Row" - One row of the table is selected (i.e. 1-dimensional array is created).
The index value must be an integer:
- index>=0 means the index of the selected row (zero-based index).
- index=-2 means the last row.
"Col" - One column of the table is selected (i.e. 1-dimensional array is created).
The index value must be of the String type or of the Integer type:
- If it is of the String type, then it is the column name.
- If it is of the Integer type, then index>=0 means the index of the selected column (zero-based index), index=-2 means the last column.
"Table" - The whole table is selected in the form of the array of rows (i.e. a 2-dimensional array is created as default Col,Row). See (Col,Row) - 2-dimensional array meaning an array of rows.
The index value must be set to the value: null for JavaScript or Empty for VBScript.
"All" - Caution! The whole table is selected in the form of the array of columns (i.e. a 2-dimensional array is created as default Row,Col).
The index value must be set to the value: null for JavaScript or Empty for VBScript.
index(Variant) Index into the table whose meaning is defined by the sType parameter.
aArray(Array) Array of values (PmArray object for JavaScript or Array data type for VBScript) created for example by the GetArray method.
Return value:
true - Assignment of values proceeded successfully.
false - Otherwise
Note:
This method only assigns values to existing items in the table - thus for example the insertion of a new row is not performed.
If the number of items of the assigned array doesn't equal the number of selected items, then only those items that can be assigned, are assigned. The assignment always proceeds from beginning (e.g. from the first item of the row) and if the array is "small", then not all items have to be assigned (e.g. nothing is assigned into the last items of the row).
"Read only" columns: Each cell is empty at the beginning. The cell is considered empty also if it contains numeric value 0 or an empty string "". New value can be written into such cell. After writing a non-zero value into the "Read only" column the cell is "locked". "Locked cell" becomes a constant and cannot be written again. Other still "unlocked" cells can be written into as needed. Methods that write into multiple cells simultaneously will write the values only into "unlocked cells" while the content of "locked" cells remains unchanged.
Example:
Last row of the table is set by the content of the arr array
JavaScriptVBScriptSelect and copy to clipboard

var oDataTable = pMe.Pm("/DataTable");
var arr = Pm.Array1("Param1", 1, 2.5, 4);
oDataTable.SetArray("Row", -2, arr);

History:
Pm8.02.14: Fixed bug: While writing into a cell the value was not converted to the desired data type of the column.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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