I want to add Col before another Col. I use Invoke Method, but don’t know use Parameters ?. Please help me
DT_Input.Columns(“AddCol”).SetOrdinal(DT_Input.Columns(“AddCol2”).Ordinal)
I want to add Col before another Col. I use Invoke Method, but don’t know use Parameters ?. Please help me
DT_Input.Columns(“AddCol”).SetOrdinal(DT_Input.Columns(“AddCol2”).Ordinal)
Because the specific column is dynamic so I don’t know index just know header col.
Hi @anh.nguyen
You can insert column at a specific place by using insert column activity. But this is an excel activity.
I dont know what place will add col, just can add New Column before specific Column (know header Column)
Hi,
The following is a sample which add new column before another column named “colX”.
Hope this helps you
Sample20230407-8L.zip (4.8 KB)
Regards,
You can find the index index of the column you know by using:
dt.Columns.IndexOf(“ColName”)
Then you can add data column and set it to the index you want by using set ordinal function in invoke method.
Hope it helps.
Regards,
Harshith
You can also give column header name. You can mention the specific column name then there is an option which to set where you need to add after or before.
Hi,
We cannot add new column named “AddCol” because it already exists. (Column name must be unique)
Do you want to create table which has 2 or more same name columns?
Regards,
Hi,
there is no AdCol column at first. after run your code it added AdCol column before QUANTITY (PC/PCS)> if I test change name, still this error
Hi,
Can you share content of the datatable at Local panel when workflow stops due to exception?
Regards,
That column is already present.
Are you using add datacolumn inside a loop? If yes, it is giving error in 2nd iteration.
Oh yeah in loop. Thank all so much
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.