How can I insert a Column into a specific position in a DataTable ?
You can achieve it using AddDataColumn activity and SetOrdinal method.
Here is an example:
InsertColumn.xaml (7.4 KB)
Please go through with these links
Hello Susana , can you check your .xaml maybe the link is broken.
Here is a new example to insert a new column C between columns A and B.
InsertColumn.xaml (8.8 KB)
Let me know if you need something else
Thanks! just one question, i don’t know where you specify the position of the column C . if i’ve understood fine you create a Datatable, print it, insert new column C name C, value C1 into the datatable that you created and then reorder but i i want to know where you especify the position
I have specified the position of the column using the method setOrdinal in the invoke method activity:
The DataColumn.SetOrdinal(Int32) method changes the ordinal or position of the DataColumn to the specified ordinal or position.
When you change a column’s ordinal, the column is moved to the new position in the collection of columns. Any columns between the previous and new ordinal will be renumbered, to adjust for a column’s new ordinal.
Thank you so much! you helped me a lot!
Glad to help you @naotosx
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.