Skip a row in the middle

I have a datatable with 300 rows, so i want to skip row number 200 how do i do it in UiPath

Please help

@Girid

datatable.AsEnumerable.skip(200)

Cheers!!

Hey @Girid ,

If you have a fixed rows that is you want to remove 200th row,
then u can use below Linq query

dtData.AsEnumerable().Take(199).Concat(dtData.AsEnumerable().Skip(200)).CopyToDataTable()

Hope it helps you!

Hi @Girid

Try this:

Assign activity:
    rowIndexToSkip = 200

Assign activity:
    dtFiltered = YourDataTable.AsEnumerable().Where(Function(row, index) index + 1 <> rowIndexToSkip).CopyToDataTable()

Hope it helps!!

If you are looping through it with For Each, you can the Continue activity. Just include it in an If where you check the current row’s index.

@Girid

You can do this as you know the row index…use the below in assign

Dt = Dt.AsEnumerable.RemoveAt(199).CopyToDataTable

As the index of 200 is 199 it rows row 200

Hope this helps

Cheers

Hey @Anil_G ,

I get error
error BC30456: ‘RemoveAt’ is not a member of ‘EnumerableRowCollection(Of DataRow)’.

This skipped all starting 200 rows

It worked thanks for it

It was too slow with activities

Glad it worked, kindly mark appropriate answer as solution and close this thread

1 Like

@Girid

Ah my bad…this is the one

Dt.Rows.RemoveAt(199) to be used in invoke code

or using invoke method

Glad you resolved anyways

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.