RemoveCol - method of the PmaDataTable object
Description:
Removes one column on the specified position. Existing columns after this position are moved. All rows of the table are removed as well !
Syntax:
Long RemoveCol(Variant Col)
Parameters:
Col | (Variant) If the value of this parameter is the number >=0, then it is the column index (zero-based index) that has to be removed.
The -2 value means that the column has to be removed from the end of the table.
If the value of the parameter is of the String type, then it is the name of the column that has to be removed. |
---|
Return values:
Returns the index of the removed column. It returns the negative number if an error occurred (the column has not been removed). Then the error is written into the
INFO system.
Note:
Caution! Column of the data type
Identifier cannot be removed (if present). Only the following columns can be removed.
"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 rows or columns 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:
- The forth column is removed (the column on the index 3)
- The last column is removed
- The column named "abc" is removed
JavaScriptVBScriptSelect and copy to clipboard
var oDataTable = pMe.Pm("/DataTable");
oDataTable.RemoveCol(3);
oDataTable.RemoveCol(-2);
oDataTable.RemoveCol("abc");
Dim oDataTable
Set oDataTable = pMe.Pm("/DataTable")
oDataTable.RemoveCol 3
oDataTable.RemoveCol -2
oDataTable.RemoveCol "abc"