InsertRow - method of the PmaDataTable object
Description:
The method inserts new row (or more new rows) on the specified position. Existing rows after this position are moved.
Cell values in new row are empty (data type
null for
JavaScript or
Empty for
VBScript).
Syntax:
Long InsertRow(Long Row, [Long Count])
Parameters:
Row | (Long) If the value of this parameter is >=0, then it is the row index (zero-based index) where the new row has to be inserted.
The -2 value means that new row has to be inserted to the end. |
Count | [optional] (Long) The number of new rows.
The default value is 1. |
---|
Return value:
Returns the index of the first inserted row. It returns the negative number if an error occurred (the row has not been inserted). Then the error is written into the
INFO system.
Note:
Maximum row number depends on
PROMOTIC runtime licence and is:
PmRtProf: 65535,
PmRtFree: 30 and
PmRtXX: XX (for example
PmRt100: 100).
"Read only" columns:
If at least one cell is locked in "Read only" column by writing non-empty value, then the whole structure of the table is locked. Then it is no longer possible to add or remove columns or rows or change the structure of the table. The structure and dimensions of the table must be defined and modified before writing first non-empty value into a cell in "Read only" column.
Example:
In the
/DataTable object (of the
PmaDataTable type) the following operations proceeds:
- One new row is inserted to the beginning (on the row on the index 0)
- Five new rows are inserted at the end of the table
JavaScriptVBScriptSelect and copy to clipboard
var oDataTable = pMe.Pm("/DataTable");
oDataTable.InsertRow(0);
oDataTable.InsertRow(-2, 5);
Dim oDataTable
Set oDataTable = pMe.Pm("/DataTable")
oDataTable.InsertRow 0
oDataTable.InsertRow -2, 5