Folks,
Is there any possible ways we can delete multiple columns at a time from collection?
If yes, Kindly notify please, and if it's possible from code please send code.
Thanks
Salman Ahmed
Not enough info. You can just select() columns you need, if you know the field names.
string[] selectedColumns = new[] { ""Column1"",""Column2""};
DataTable outDataTable= new DataView(inDataTable).ToTable(false, selectedColumns);.
Hi Salman,
This is my solution using the code stage( I don't know if there is an action that allow to delete multiple columns ):
The following code deletes all columns from the collection where the column header starts with ""Column"" but you can change the criteria to your needs
BP_Collection_Out = BP_Collection_In
for count as Integer = (BP_Collection_Out.Columns.Count - 1) to 0 Step - 1
if BP_Collection_Out.Columns(count).ColumnName Like Deleting_Pattern then
BP_Collection_Out.Columns.RemoveAt(count)
end if
next
Inputs for code stage:
BP_Collection_In: collection I want to delete the columns
Deleting_Pattern: Your criteria to delete columns
Outputs for code stage:
BP_Collection_Out
Hope this helps.