How remove data rows in datatable to index number to index number

i have remove from index 8 to index 14 how to remove this rows in datatable in UiPath … example for below this datatable

s.no Date
1 ********
2 30/04/24
3 30/04/24
4 02/05/24
5 02/05/24
6 02/05/24
7 02/05/24
8 02/05/24
9 02/05/24
10 02/05/24
11 02/05/24
12 02/05/24
13 02/05/24
14 02/05/24
15 02/05/24
16 02/05/24
17 02/05/24

Use Remove data row activity in datatable.
You can create for loop from 8 - 14 inside use remove data row

Hi @domsmgtmeet22

you can directly use REMOVE DATA ROW activity and simply mention the index range like below.

1 Like

hello @domsmgtmeet22 ,

you can achieve the by linq it will be faster and efficient

just attching screenshot for your reference,

Regards,
Dheerendra vishwakarma

in a conservative implementation we can do:

For each activity | item in Enumerable.Range(8,7).Reverse()

  • Remove Data Row Activity: RowIndex: item, DataTable: YourDataTableVar

As we reversed the series and deleted with the highest index we are not confused by changed index, when deleting within the loop

OR

dtCleansed = dtData.AsEnumerable.Except(dtData.AsEnumerable.Skip(8).Take(7), DataRowComparer.Default).CopyToDataTable

OR also many other options and variations.

@Baskar_Gurumoorthy
Just share with us a screenshot where the Activity is handling an int32 Range (within an int32 Field) but is not interpreting 8-14 Formula to result of -6 and will fail on runtime. Thanks for Support