cancel
Showing results for 
Search instead for 
Did you mean: 

Delete multiple columns from collection

SalmanAhmed
Level 4
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
Salman Ahmed System Engineer Asia/Kolkata
4 REPLIES 4

AndreyKudinov
Level 10
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);.

MichalSzumski
Level 6
Hi Salman,   You can just create collection with these column names in rows and then loop on in with delete action inside.   Best regards Michal.

ErgesKokoshi
Level 2
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.

SalmanAhmed
Level 4
Thank you all :)    
Salman Ahmed System Engineer Asia/Kolkata