Create column with default value

Hi,

i have a Dt, i wanted to create a new column with default value as “N/A”. I used add data column activity but it is adding column at the end of datatable. i wanted to add new column as the first column. How to achieve this?

This should help:

@Sirisha_Siri Try this workflow

Example.zip (2.7 KB)

Capture

Hi @Sirisha_Siri ,

Placing the Column at a Particular Position, we use Invoke Method on Datatable Column’s Set Ordinal Method like below :
image

0 indicates the First Position.

or

If we do know the Column Names, we can use Filter Datatable activity and Mention the Column Names in the Order Required, the Output Datatable will have the Datatable Columns in the Order Mentioned :
image

Similarly using DefaultView.ToTable() we can achieve the same functionality.

DT = DT.DefaultView.ToTable(false,"New Column Name","Other Column Name1","Other Column Name2")

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.