Can I add a "while" to a Blue Prism loop?

anonym723615

New Member
My specific question is whether I can manually change the Blue Prism code to add a "while" control to the loop action. I want to put "while Client ID does not change, loop". However, any other alternative for the same use would be accepted.

I also wonder (just out of curiosity) if one can manually alter the code in Blue Prism (as I understood, the "code" function is to write some code in another application.

Thanks in advance
 
BP has provided some of VBOs which have codes written - we do not see while using these in our Processes or Objects.
The codes can be amended - do a SaveAs the VBO which you would like to customize, give a different name, such as suffix "Extended".
Here, you can make whatever change you would like, do proper testing and voila.

Alternate to while loop:
Loop stage in BP is wonderful as it takes information from Collection and finishes all records there.
Just need to use collection manipulation VBO to filter out only the records you need to loop through, put into a new collection and run Loop from the new collection.

This will be neat too.

Regards
Bidur
 

VJR

Well-Known Member
Hi anonym723615,

My specific question is whether I can manually change the Blue Prism code to add a "while" control to the loop action

The code for the Loop stage is not visible to us as it the same for the internal Business Objects (eg; Work Queues, Collections, etc).

I want to put "while Client ID does not change, loop". However, any other alternative for the same use would be accepted.

You cannot create a new shape/stage other than the ones available on the left hand side. But you can very well use the Code stage and write code to it such that it will handle your application in the desired way. The code stage can be written in Visual Basic, C# or J#. You can to take a While loop in the code and loop it against your Collection and return the desired output accordingly.

I also wonder (just out of curiosity) if one can manually alter the code in Blue Prism (as I understood, the "code" function is to write some code in another application.
Regarding manually modifying the code, go to the object studio and open any existing VBO, say Ms Excel VBO. You will find in those tabs (called as actions), that there is a Code stage with code written in it. You can go ahead and very well modify that code. But it is not recommended because those are VBOs provided by Blue Prism during tool installation. Alternatively, you can make a copy of the entire VBO, give it a different name and make the required code changes. Or for example you want to create a new action for Excel you can even add a new tab/action in the existing Excel VBO in which case the other actions will remain untouched and you still have one single VBO for all Excel related activities.
So in your case as an example assume you are getting the data from a Collection using the 'Get Worksheet as collection' action of the MS Excel VBO. Now you want to have a while loop on that data.
Make a copy of the 'Get Worksheet as collection' give it a new name of your choice like 'Get Worksheet as collection for ClientID'. In this new action you will already be having the code to get the worksheet into a collection. You will further write a new code to take this collection and add a While loop based on a ClientID. You can design this action in such a way that this ClientID can well be passed as a parameter from the calling Process so that this new action of yours now becomes customised and re-usable from any process for any ClientID.
This should be the main intention of creating objects and writing codes - to be customised, re-usable and easy to understand and use.
 
Top