For each Row In DataTable Uipath

Please help I am facing this issue: For Each Row in Data Table: Collection was modified; enumeration operation might not execute.

I am ready data from a datatable and after that I write data extracted from database on the same datable.

Hello,

You can’t modify the datatble you iterate on, you have to do a copy and modify the copy :slight_smile:

Hi @Andile_Wayne_Lukhele

Can you tell us what are modifying in the same datatable?

example
So I read the Car Brand and get the Model on database then after I write the Model on that datatable.

Hi @Andile_Wayne_Lukhele

Inside the for each row activity

Use Assign activity

Currentrow("Model") = Your output value

Outside the For each row activity

Use Write range activity

Regards
Gokul

Check out the workflow skeleton @Andile_Wayne_Lukhele

Regards
gokul

I completed the assign part issue is when I write data, It will write the CurrentRow but throws an error when it suppose to write 2nd model.

Can you share the screenshot of the error and your workflow @Andile_Wayne_Lukhele

Hello @Andile_Wayne_Lukhele

You can do as below. Make sure you are in the modern designer.

Thanks