Insert column
Command Description
Insert a new column before the specified column in the data table and fill it with data
Command Prototype
Datatable.InsertColumn(dtTable, column,index, objDefaultValue)
Command parameter
parameter | mandatory | type | default value | Instructions |
---|---|---|---|---|
dtTable | True | expression | objDatatable | The data table object newly inserted into a column and filled with data, usually the return value of the "Build Data Table" command or the "Build Data Table from Excel Table" command |
column | True | string | "" | Column name for newly inserted column |
index | True | number | one | Specify which column already exists in the data table, or add 1 to the maximum number of columns as the position, and insert a new column before this position |
objDefaultValue | True | expression | [] | Support filling array format data into newly inserted columns, and the length of the array must be equal to the number of rows; It also supports filling with the same single value; If you do not want to fill in the content, you can keep it as the default value (empty array), and the final newly inserted column will be an empty text column |
Return result
Run instance
/*********************************Insert Column*****************************************
Command Prototype:
Datatable.InsertColumn(dtTable, column, index, objDefaultValue)
Input Parameters:
dtTable -- Data table object. Note: The data table object that will have a new column inserted and filled with data, typically the return value of the "Build Data Table" command or the "Build Data Table from Excel" command.
column -- New column name. Note: The name of the newly inserted column.
index -- Column position. Note: Specifies the position before which to insert the new column, either at an existing column position (the nth column) or at the maximum column count plus 1.
objDefaultValue -- Column data. Note: Supports filling the new column with array-formatted data (the array length must equal the number of rows), or filling with the same single value. If no content is desired, it can remain as the default value (empty array), resulting in an empty text column.
Output Parameters:
None
Notes:
None
********************************************************************************/
Datatable.InsertColumn(objDatatable, "",1, [])