How to move Column from Index 0 to Index 10 in datatable

I have to move the column from Index ‘X’ to Index "Y’ in a datatable for processing,please help.

2 Likes

MyDataTable.Columns["MyColumn"].SetOrdinal(Y)

Thank you , but which activity i can use to set this property?

Hi
Hope this step could help you resolve
— use a INVOKE METHOD
Where in the Target object mention as
Yourdatatable.columns(“yourcolumnname”)
— in Target method mention as SetOrdinal
— in parameter property in property panel of Invoke method mention
Direction as In
Type as Int32
Value as 10

Simple isn’t it
Cheers @Ramki81

4 Likes

Use Invoke Code activity:

  • Use as arguments:

    • an In/Out DataTable with your datatable as value
    • an In Integer with your column index as value.
  • Edit the script with your code.

You need to pass the datatable as argument allowing the script to access it and return it modified. You can hard code the column name and its index. You can put multiple column index changes. You can pass the values as argument if you prefer.

image

image

2 Likes

Thank you, it works.

1 Like

Thank you , it works

Cheers @Ramki81

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