Promotic
WikipediaLinkedInYoutubeTwitterFacebook

InsertCol - method of object PmDataTable

Description:
The method inserts one new column on the specified position. Existing columns after this position are moved. All rows of the table are removed !
Syntax:
InsertCol(Col As Long, Name As String, Dt As Long) As Long
Calling:
oDataTable.InsertCol Col, Name, Dt
Parameters:
Col(Long) If the value of this parameter is >=0, then it is the column index (zero-based index) where the new column has to be inserted.

The value -2 means that new column has to be inserted at the end of the table.

Name(String) Name of the new column. Already existing columns in this table mustn't have this name.
Dt(Long) Data type of the column. See VBScript constants of data types.
Return Values:
Returns the index of the inserted column. It returns the negative number if an error occurred (the column has not been inserted). Then the error is written into the INFO system.
Note:
Maximum number of columns depends on PROMOTIC Runtime License and is: PmRtProf: 65535, PmRtStandard: 50000, PmRtLite: 100, PmRtFree: 30

"Read only" columns: If any cell is locked in "Read only" column by writing non-empty value the 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.

Caution! New column can be inserted after the column with data type Identifier (if present).

See also:
Example:
In the object "/Data/Params" (of the PmDataTable type) one new column is inserted at the end of the table. The column has the name "abc" and it is of the Long data type:
Dim oDataTable
Set oDataTable = pMe.Pm("/Data/Params1")
oDataTable.InsertCol -2, "abc", vbLong
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice