I want to add new column in existing DT at run time, so i used invoke method for same, but getting error on method name, i put method name as SetOrdinal.
Please find attached xml for same, Help me to find my error, Thank you in advance.Add_Column_Run_Time.xaml (6.8 KB)
Your issue with the xaml is fixed buddy. Made small changes as below.
–Changes with target object
–specified parameter in invoke method properties, that specifies the index where the column must be added.
One small suggestion, you can even add columns to a dt at runtime, if we iterate the datarow in the datatable, next with add column activity, all in for each loop, instead of for each row loop. We shall use invoke method to add columns if we want to add columns in the middle of table or change the position of newly created column.
Kindly find the resolved Xaml file, Hope this would help you…
Add_Column_Run_Time.xaml (7.8 KB)
@Palaniyappan: Thank you for solution, Just want to ask you ,what shall i write if i want to add particular column on 3rd place?
Also as your suggested another solution for run time column addition do you have any sample xml of it?
Change the parameter as 3 …in invoke method while adding column
Didnt get you , As per solution xml provided by you , in target object you just mentioned dt.Columns(“Col”) where to pass 3?
Oh sorry…ok…no problem
If you want to add column to the middle of the datatable…you must read those as datarows in for each loop instead of for each row loop. Inside which we should have invoke method activity to add columns in specific position…as mentioned earlier
No worries i will send u a xaml file in 5 mins…for your reference…
Sorry for the misunderstanding of ur question
Here is your xaml buddy…
invokeaddcolumn.xaml (8.8 KB)
Book11.xlsx (13.5 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.