Hi, How do i Remove multiple rows from a data table specifically indexes from 0 to 54?
If you just want to delete the first 55 rows (0-54) you could just use
Skip method like this:
If you want to delete every row after the index 54, you could use
Take method like this:
Thank you. Forgive me as i am new. do i put the expression you mentioned into an assign activity and assign it to the datatabel variable?
No problem, we’re all here to learn!!
That’s correct, what you need to do is assign that expression to a data table variable. You should consider if you are going to need the complete table afterwards, if that’s the case, you should create a new variable to assign the expression to.
agreed!! RPA is amazing.
Ok that makes sense. Its a tricky case because in a whole i need to filter the rows like the below and then output the rows to keep to particular columns in an excel spreasheet.
row1[Value1] < Skip
row54[Value54] < Skip
row55[Value55] < Keep and then assign to column1 in new datatable
row56[Value56] < Keep and then assign to column2 in new datatable
row57[Value57] < Keep and then assign to column3 in new datatable
Would be i be on the right track using your expression to skip and then i need to assign the remaining rows to a datatable
Not sure the best way to do this?
There are a few ways to do this, a simple solution would be to do this four assigns:
dtReduced = dtComplete.AsEnumerable.Skip(55).CopyToDataTable
dtCol1 = dtReduced.Copy
dtCol2 = dtReduced.Copy
dtCol3 = dtReduced.Copy
And then remove the columns you don’t want from each new datatable (dtColX).
This is messy and definitely not the best solution, but it’s the easiest one. When I get home I can send you a better solution, that has the column filtering at the same time that you are copying the table.
Thank you. Each dtcol you mean are seperate data tables are they?
That would be great!!