Dataset - Insert column
Declaration
<AMDATASET ACTIVITY="insert_column" DATASET="text" COLUMNLOCATION="text (options)" INDEX="number" COLUMNNAME="text" NEWCOLUMNNAME="text" />
Description
Inserts an blank column anywhere in a dataset.
Practical usage
Used to insert an blank column anywhere in a dataset.
IMPORTANT: Some column names may contain special characters (for example, !-()@#). In this scenario, you must manually add a bracket notation to the column name for the Task Builder to interpret it correctly. For example, %DatasetName.[File_Size_(MB)]%.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Dataset name | Text | Yes | (Empty) | DATASET="customers" | Specifies the dataset to insert the column into. |
Insert at | Text (options) | Yes | End |
|
Specifies where to insert the column at. The options are:
|
Column index | Number | Yes, if Insert at is set to Column index | (Empty) | INDEX="5" | The column index number to insert the column at. This parameter is required if Insert at is set to Column index. NOTE: The column index number entered must be greater than 0. |
Column name | Text | Yes, if Insert at is set to Before specified column name or After specified column name | (Empty) | COLUMNNAME="Status" | The name of the column to insert the new column before or after. This parameter is required if Insert at is set to Before specified column name or After specified column name. NOTE: All available columns stored in the dataset will automatically appear in the Column name box after the selected dataset has been run at least once in the Task Builder. |
New column name | Text | Yes | (Empty) | NEWCOLUMNNAME="New" | The name of the column to insert. |
Example
NOTE:
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This task uses the Create, Insert Row, and Insert Column Dataset activities to first create a dataset with three columns, append a blank row at the end of it, and then finally inserts a new starting column in the dataset.
Copy
<AMDATASET RESULTDATASET="myDataset" COLUMNS="heading1;heading2;heading3" DELIMITER="semi_colon" DESCRIPTION="This is user input description showing in variables panel of Task Builder" />
<AMDATASET ACTIVITY="insert_row" DATASET="myDataset"><COLUMNSETTER COLUMNNAME="heading1" VALUE="value1" /><COLUMNSETTER COLUMNNAME="heading2" VALUE="value2" /><COLUMNSETTER COLUMNNAME="heading3" VALUE="value3" /></AMDATASET>
<AMDATASET ACTIVITY="insert_column" DATASET="myDataset" COLUMNLOCATION="index" INDEX="1" NEWCOLUMNNAME="First Heading" />