"Next" or "Continue" - Control Flow

Allright, so there’s the “Break” activity for when you want to break out of a loop. But what about the times you just want to skip to the next element in the loop? Sure, a switch or if-statement would do the trick, but it’s messy and unnecessary.

It would be much appreciated if you could implement the “Continue”/“Next” functionality for loops: Continue Statement (Visual Basic) | Microsoft Learn.

6 Likes

The same thing i had asked them right at the first time while my training was on.
There was no way that time.
What I have done is that all the loop body is placed in a Try-Catch(With Custom Message)
In the loop body(which is in the Try Block), where ever you need to have a continue, simply put a throw exception activity with your custom error message.
In the Catch block, trap all exceptions and get the exception message.
If the exception message is same as your custom message then consume the exception so that the execution will continue to next iteration. If not then put a ReThrow.

But nonetheles…we definitely need a Continue activity.

5 Likes

Yes, I agree with you I have noted too It is messi and in some cases a waste of time

1 Like

UiPath,

Could we have an answer on this topic ?
A “next/continue” activity would be great and usefull in many cases.

Thanks and Regards

1 Like

You can branch within a loop using If/Else statements. If the branching is too complicated you can use a flowchart within the loop (instead of sequence).

I would not recommend the use of “continue” in the middle of a large loop block for readability purposes.

1 Like

If the element needs to be completely skipped, which usually is the first thing that’s checked in the loop, one could use a .Where clause:
foreach (item in collection.Where(Function(x) x > 17)) { ... }
Due to iterative nature of LINQ queries it’s functionally equivalent to (and perfomarnce wise negligibly different than):
foreach (item in collection) { if (x > 17) { ... } }

It needs some getting used to, but (un)fortunately structuring workflows needs to be a little different from “standard” code. Nesting activities is way more exhausting to read than nesting scopes with proper indentation.

1 Like

This is one more case where we could make use of the System.Data.DataSetExtensions which is not currently available. I have also mentioned this in some other post in this forum.

1 Like

hi UiPath any updates on this?

1 Like

Could you please provide an example?

done!

2 Likes

invoke phyone 如何达成

Hi,

I have the same issue as the guys above, and am a bit lost. :slight_smile:
By done do you mean that a next/continue activity has been implemented in UiPath Studio?

Thanks,
Razvan

I can see the “Continue” activity in 2018.2.3 version.

1 Like

Hi badita

I can see a continue activity now .
Is there a “next” activity which will skip the current item and move on to the next item in loop ?

Avi

1 Like

because of this bs i have to use if else, and at this point even if i have a 50inch monitor i might still need to scroll sideways.

and its not like this hasnt been suggested before.

2018-2-beta has it.

2 Likes

Duplicate, but yes, it is out.

1 Like

Thanks. Will it be out of beta, and on the orchestrator soon?

Hi @akhi_s27,

Do you have sample xaml as i looking for one of my flow,as i getting the sam error continuosly and want to continue loop .

Now There Is A Workflow Control Activity ( Continue ) You Can Use For Skipping The Current Iteration of Loop

Activity Under

Workflow →
Control →
Continue

Thanks