Hi,
I need to change the format of a DataTable by rearranging columns and including blank columns in-between. Can you help help me the process to do so.
PFA the old_csv and preferred_csv.
Hi,
I need to change the format of a DataTable by rearranging columns and including blank columns in-between. Can you help help me the process to do so.
PFA the old_csv and preferred_csv.
Hi @shrayud !
I donāt know why but I have an error when i try to unzip your folder.
Anyway, to add columns, you can use āAdd DataColumnā activity and precise the index you want the column to be added and give it a dummy columnName
To change the position of the columns, I use an artisanal way: by using Filter datatable activity, and add all the columnNames at the column field in the wanted order. I am sure there is a better way, but for the time being itās a clue
For Rearranging the table columns you can use Set Ordinal method in the invoke code activity using the below code:
Dt.columns(āyourcolumnnameā).setordinal(5)
I just gave 5 as an example here.
Hey thanks:
error BC30451: ādtCheckā is not declared. It may be inaccessible due to its protection level. At line 1
This error is coming. dtCheck is my datatable
Oh sorryā¦you have to use Invoke Method activity.
I will share the sample once I am back.
hi @shrayud ā¦ Please find the sample belowā¦
My Input:(Status column is 2 i.e. index 1 (index starts of 0)
Invoke Method ( here I gave, so that Status column will be moved to 0)
You can see the output in my first screenshot.
Hope this helpsā¦
Thanks,
I also need to delete few columns like in your case:
[ID Status Value Date] It needs to be
[ID Date Value] I want to remove status column while rearranging; can I do so using Invoke activity
@shrayud - You can use āRemove DataColumnā Activity and give ColumnIndex as 1 (in your case)ā¦
or you can useā¦āInsert\Delete Columnsā inside excel app scope ā¦and choose remove in the property and give the column positionsā¦
Thanks
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.