How to delete rows from a data table within the same for each loop?

Hi All

I have a data table with following data.
select method

I need to delete all the records of Jan 21 after reading the first Jan 21 record. So after the first iteration of for each row I have to filter out all Jan 21 records and remove from the data table within the for loop.

Issues faced:

  1. Using filter activity and then using Remove Data Row within the filtered data table throws below error.
    For Each Row: Collection was modified; enumeration operation might not execute.

  2. Using Select method also throws error as we need to pass the column value in ’ ’ single quote and the data itself contains ’ single quote.

Can anyone help how to delete the rows within the for loop after filtering ?

Hi @kkpatel,

you can’t change the datatable while accessing it via the for statement. There are several ways to accomplish your task that can be found in this forum.

For example: Click here

1 Like

Thanks @mp3ItIs. Will try to apply some other logic.

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