How to start process from the beginning with nested loops?

Hey guys, i’m pretty new to UiPath.

I have following scenario:

Process starts, gets in several nested “for each row” loops.
I’m using “break” activity to end each loop, i didn’t know how to handle it else.
Now i want it to start all over again after the last loop, but of course with continuing with the next row from my DataTable.

Before i used the break activity it started not from the top but from the innermost loop, what i don’t want!

What i want is this:

{
Click
Click
Click
Loop1
Click
Click
Loop2
Click
Click
Loop3
Click
Click

Start again from the beginning }

Hi @motorlab_9 ,

Perhaps adding and organizing all your activities within a Flowchart activity https://docs.uipath.com/studio/docs/flowcharts might help you solve the issue

Best regards,
Marius

EDIT: its looping the first “for each row”…how can i change this? I also tried with break activity, but then it starts with the first row again instead of continuing with second row.

Hi @Marius_Puscasu

thanks for your answer.
I did it now in a flowchart, see attached image. Every ‘For each row’ should only loop once and continue with next step, will that work?

Hi @motorlab_9,

For the “but then it starts with the first row again instead of continuing with second row.” I suggest using a counter, initialized just before using the break activity. This counter should store the row index from your ‘For Each Row’ activity

At the beginning of the process (1st loop) the counter should be 0, while next time (2nd loop), the counter should be the stored value, and so on

Hope this helps
Best regards,
Marius

Hey Marius,

i’m still trying different methods, thats why i’m always deleting my previous answers.
So i tried to assign a counter in the first “for each row” loop, but it says:

"Operator ± is not defined for types “System.Data.DataTable and Integer”.
I already looked on other posts, but i don’t get what i have to change to compile correctly.
Please have a look on both images.

Thank you!

@Marius_Puscasu quick update, i finally figured it out, it was too simple and i was thinking way too complicated.
I didn’t need nested ‘for each row’ loops, so i built a process just with one loop and everything works fine. I should definitely watch the tutorials… :slight_smile:

1 Like