"Next" or "Continue" - Control Flow

i_completed
loop
activities
r_18_2

#1

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: https://msdn.microsoft.com/en-us/library/801hyx6f(v=vs.100).aspx.


Its ridiculous that there is a break activity but not continue
Its ridiculous that there is a break activity but not continue
#2

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.


#3

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


#4

UiPath,

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

Thanks and Regards


#5

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.


#6

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.


#7

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.


#8

hi UiPath any updates on this?


#9

Could you please provide an example?


#10

done!


#11

invoke phyone 如何达成


#12

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


#13

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