Exit a For Each once target is found

Hey team,

Am using a For Each Row on one DataTable, to iterate through each row of another DataTable (2 nested For Each Row). Once i have a match with row from dtb1 with a row on dtb2 (based on variables from each, extracted via Get Row Items), i don’t need to keep looking for matches in dtb2, but rather move onto the next row in dtb1 and look for new matches in dtb2 with new row info.

QUESTION: How would i stop the For each row search and move to next row (dtb1) once once variables are found (row in dtb2), instead of wasting time going through rest of rows in dtb2, looking for something that has already matched?

Thanks
MikeB

Hi @MikeBlades

You can use the If condition to check for the match in the 2nd for each followed by “Break” activity which when found will exit the for each.

Thanks,
KJ

2 Likes

Hello @MikeBlades :slight_smile:

Thank you for your inquiry, look at this picture, the if activity is inside a for each and when I find the item that it is a 4 characters lenght stops

image


If this is the answer to your post, don’t forget to like it and mark it as solved.

Happy Automation !!

regards :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.