Hey quick question… For the “Remove Data Column”, is there a way to delete a range of columns using the “ColumnIndex” input? I need to remove like 16,000 columns
Thanks!
Hey quick question… For the “Remove Data Column”, is there a way to delete a range of columns using the “ColumnIndex” input? I need to remove like 16,000 columns
Thanks!
your best bet here is to create a while loop and remove all inside it… if you want to keep like the first 10 for example, code would not be super hard…
DataTable dt;
int desiredSize = 10;
while (dt.Columns.Count > desiredSize)
{
dt.Columns.RemoveAt(desiredSize);
}
So may I know how may columns are there actually
@jamills
@jamills You may want to modify how you’re getting the datatable originally. Grabbing 16,000 unnecessary columns and then deleting those 16,000 unnecessary columns will likely add some significant overhead to your process.
Depending on how your table is structured and how many columns it contains, it may be faster to simply take the amount of columns needed and copy to a new datatable. This would be done with 2 activities - the first to take ‘n’ columns, and the second to take the data from each datarow in ‘n’ columns using LINQ.
Otherwise if you want to delete everything, you can use a for each column in Datatable.Columns statement and the ‘remove datacolumn’ activity
Keep in mind that if the columns are not sequential, you can’t use either of the above methods and you’ll have to iterate each column and check the column name or some other similar method to identify the columns that need to be removed
sure thing, maybe changing the range of the read range if he knows which columns he dont need and they are all in the end of the table…
you can go through this link this will be helpful
if any doubts regarding packages and activities ask @balupad14 cheers @jamills
This worked like a charm and only added 10 seconds to overall runtime
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.