Search code examples
blueprism

How quit a loop when my condition is met?


I'm working with BluePrism and I have to loop though collections, sometimes there is +1000 rows.

For example :

I loop though a collection and search for the word "hello", if this word is found at row 10 I want to stop looping the rest 990 rows. And right after that do another loop for another word in the same collection and so on.

Is this possible ? Currently I'm looping til the end of the collection, It works fine but takes a lot of time.

Thank you in advance and sorry for my bad english.

I don't have enough reputation to post image so there is the link : https://i.sstatic.net/yrp5p.jpg


Solution

  • You really should not be using loops to find information in collections. For that there is an action called Filter Collection within the Utility - Collection Manipulation VBO.

    Other than that, your code snippet is OK, that's how you would exit a loop based on a condition.