Extract Column B and C if Column D has the same value as the next row

I would like to extract Column B and Column C’s value if Column D has the same value as the next row’s Column D. After extracting those values into a new Excel workbook, they will be used to create a HTML table and send to Email, the newly created Excel workbook will be cleared and the process will be repeated until there is no value to be read in the Excel.

Table
Table2
There should be 4 person in total in the table.




Every time I run the process, there will be an error that says "Collection was modified; enumeration operation might not execute. ". The table has successfully been created but there will always be a missing person. I am fairly new to RPA so I would very much appreciate if someone would assist me on this.
Task.zip (33.2 KB)

Well,

I have seen the above mentioned error when developers try to edit or change the collection in a loop.

You cant run operation on a collection or data tables when in a loop (or on which object you are running a loop on)

Maybe create an ad hoc data table (copy it / duplicate it) and then make changes to the Object that you arent accessing real time in a loop.

Hope this helps.

1 Like

@Dyoneus
the case look like you want to group/segement all D values and the further process a table with this groups members for each group.

If this is the case the GroupBy approach with a key to the D column could help.

Have a GrupBy demo XAMl here:
GroupBy_IDCol_TakeOldestDateRow_DecomposedLINQ.xaml (10.3 KB)

1 Like

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