How to continue to next row after getting an error withing a "For Each" row activity

activities
howto
studio

#1

Hi,

I’ve come across a problem with figuring out how to move onto the next row if my workflow gets an error/exception. I just need to move onto the next row but the only solution i could think of was using “if” activity with the whole workflow in it again, but using this logic I would be needing and infinite number nested “if” activities.

I just want to know what solutions have you guys used in order to get around this limitation.


#2

Hi,

I think whether you are using a rowcounter in a Do while or Flow Chart loop, or no rowcounter with a ForEach, both methods would involve a Try/Catch.

So, surround the Sequence where the error can occur with a Try/Catch. Then you can store a variable with a string or the exception if desired. For a ForEach, it can just do nothing in the Catch and it will move on to the next row when it loops again. For a Do while, it’s the same except you should be doing rowcounter=rowcounter+1 at the beginning so it will move to the next row. For a Flow Chart loop, you can use that variable you store in the Catch to feed it into a Decision or Switch box so you can restart the loop if there were more tasks to perform, and you should also be doing rowcounter=rowcounter+1 at the start of the loop.

I will also point out that if you need to exit the loop to do things such as close all applications then reenter the loop again (by having the Try/Catch surrounding the entire loop), then using a rowcounter is beneficial in that you can keep track of the current row you are on (technically you can also do a counter in a ForEach also)

Sorry for no visuals. I’m just typing out some suggestions quick.

Regards.


#3

Hi,

if using For Each or While loop, you can just use Try… Catch activity to go to the next row, if any error/exception comes.

Just put a Try catch activity in For each/while loop, and put all the code within it. Now if any exception occurred in the flow, it will move to the loop again.

Thanks.


#4

Thanks!