Chapter Four, process flow diagrams. In this chapter, we'll be going through an overview of what process flow diagrams are. They talk about collections data item. We'll talk about loops, the execution control and the logical process flow. Over overview. process flow diagrams are the two dimensional programs that are created within the process studio.
And it includes various stages, which perform operations and computations, which in turn, provides automation capabilities. We have already used decision and calculation stages in the previous chapter. And in this chapter, we'll continue working on process to do by making stages more efficient. Use loops for repetative processing of certain stages, along with collection data types, and setting breakpoints to work at specific programs, snippets. collections, which is right here. We have used data items before that store single values based on the data type.
Collections is a data item that store multiple values of same type, arranged in the form of a grid, like rows and columns. The data from collections is retrieved one row at a time. And we use loops to accomplish this data retrieval process. For example, let's say we have a collection, and we name it as students. And in here, we have data corresponding to a recent mathematics test that they these students gave in a particular school. So first, we give like the column names in a table, right, what our data is gonna be held in this collection data item.
So we add the fields. And the first field let's say the name of the student. It's of type text and the description you can put it just so you know, it becomes easier for everybody to comprehend. Next, let's say their class, which again let's say is text and class of students. We add the field, roll number or something or enrollment number. Which is, could be text.
These depends on the type of data these fields are going to behold. So field marks obtained and this is gonna be numeric type and And we hit OK. So we have this student data collection data item ready, where the structure is like this. If available, we can also provide some initial values to the collection. For this, we go to the initial values tab here, and we simply add the rows. And we get all those columns that we just provided in the fields tab here, and we can add some data.
Let's put some sample data in here. Kevin of class 10 has a roll number of marks obtained Oh, it says Marshall obtained here. I'll just change it in a few minutes. And let's say it's at seven Okay, you had another row. Let's keep it for just similar same class. And let's say God 72 marks.
Right, let's add one more property. And let's say it has nothing to do. Okay, so we have some data also corresponding to this collections data item. And currently, you can also see that the collection, like by default is pointing to the first row. We have three different rows right in the collection based on the data that we provided as the initial values. And we can involve like there could be several competitions involve doing the process flow like adding the rows, deleting the rows, or merging between two different rows or something like that, you know, depends.
So that's how a collection data item works. And you can draw an analogy with the edits, but two dimensional areas like in the form of rows and columns, we have data stored in the collections, and we can retrieve retrieve them one row at a time. We'll discuss the retrieval process also in subsequent chapters. Next, is loops. So the flow of a program is not usually linear. That is, the actions we perform in it tasks aren't usually in the fixed straight sequence.
We might have to go back and forth among operations and perform actions repetitively, to achieve the desired result. This is done through dupes in blue prism So the first type of loop that we're going to discuss is a circular path loop. So circular path loop is the simplest looping technique. It refers to the redirection of execution of the node of a stage within the current process flow that has already been executed. The process flow thus goes back to the stage it is pointed to and re execute the subsequent stages. Let's take a quick example.
Let's say we have, we can take this out. We have a data item and we're gonna call it as counter and it's a numeric type with an initial value of zero, right. And we have a calculation stage. I'm gonna take this expression out and And what this is doing is it's incrementing the counter by a value of one. Every time This stage is executed the calculation stage, the counter variable would be incremented by the value one. Okay, okay.
And the incremental value will also be stored in the counter variable itself. And let's take this link out. And we have a decision stage where we are saying do we want to re execute? And the condition that we're gonna put in to make sure if you want to re execute the program or not, is by saying if the counter is less than five, right? So that means we hit OK. If it is yes, like we execute That means the count the value of the counter variable is less than five, that's going to be true.
What we're going to do is we're gonna re execute the stage of incrementing the counter. Right? And if not, we'll simply end it. So another stage that we're going to talk about is the anchor stage. What anchor stages does is it provides us a way to make the program flow or the process flow diagram a little more neat and tidy. We can use these anchor points and it makes our link easier.
So If yes, then dv execution would take place if no, automatically the program would end. Right? Very simple variable, like way of looping into a program, the circular path loop, right? We didn't use any specific loop stage or anything we just used The program logic in the way that it loops and we reset. And if we hit OK, I'm going to keep this speed a little. On the lower side, you see, so first time loop again increment the counter, now the counter value is two still less than five.
Now it implemented the value again, three, still executing. Now it's for, say executing. Five, five is not less than five, so it ended. Right. So in most of the stages, we can have multiple incoming links, but the outgoing link from stages is usually one. So just see that the increment counter at this stage has two different incoming links, which is fine.
In most of the stages, that is acceptable. However, the outputs link is one from each of these, unless it's like decision stage or something specific, where we have two different directions. We are program execution can be can can go. Next we are going to talk about loop stage. Another looping action, we can use in a blueprint process flow is while loop stage. So unlike most stages, loop stage comes as a set of two stages.
Let's put. The first is the loop start and the second one is the loop end. Right this stage is used to work on collection data items. The number of iterations within the loop stage depends on the number of rows that collection holds. So, we probably shouldn't have deleted this I'm just gonna get description is completely optional. Okay, so the collections is ready.
And in this looping stage we are gonna Set the number of iterations when we open the loop start stage, we could put any name like I trading through students or any comprehensible name based on the business logic that you're implementing, let's say and we're gonna loop through the students collection. That's the name of the collection that we provide in this as an input to the loop. Let's take this out. From here, let's keep it on the side. And you have the looping stages in here, the ending stage as well. And what we're gonna do is, let's say, we're gonna take a hypothetical situation where the students who took the mathematics test recently they are There was some sort of issue in the marking from the faculty from the professors.
And the, like, each student gets an increment in their marks by a value of five. Right? So what we're going to do is, we're going to add a, this loop, what it's gonna do is it's gonna go through each and every row. Currently, it's pointing to row one. So next time, automatically when the loop ends, it goes back to the first stage of the loop. And it's gonna keep going unless we have retrieved all the rows of the student collection.
And what we're going to do is, we have to implement the marks of the students right, and prevent marks. So what we're going to do is, as you can see the best way and we also discussed this before, the best way for us to play around with the data items within a calculation stage or anything stage where we'll be using data items is by using this panel and simply dragging and dropping it into the expression builder text area, as well as in the store result, this this text area as well. So what we're going to do is we access the columns or the fields have a collection data item by using the dot operator. But since we are dragging and dropping these operators in everything is taken care of automatically by the blue prism application itself. So we take this to remarks. we increment the marks by five.
And we store the data again in the student dot marks. That makes sense. We hit OK. And we simply have to correct the length here. What has happened is, every time the loop this looping stage, it's going to go through each and every row of the students collection, increment the marks and store that data again back to the collection, field. Which is the marks field and keep continuing. And once the collection, all the rows have been retrieved, it's simply going to end the process.
Right? So we reset, and we hit the Go button. And the first row is being retrieved on second row here again, third row, and it and the program ended, all three rows have been done. Before we hit reset, we may want to see if the computation that we performed in the calculation stage actually worked or not. So if you reset it, it's gonna go back to the initial values or the compensation would be raised, right. So what you would want to do is before hitting the reset, let's check the collection.
These were the fields initial values and the current values the current values is should be five added to these this march field which is right here. So 89 plus 594. Then for the Smith, person, student, it's 83 marks and for Viper Ah, that's nice and then right, so our program works just fine. And that's how the collections and the looping statements work. We can go through different, you know, computations involved, which we will also discuss about the functions that are available, but in subsequent chapters, but to use simple arithmetic operations, simply drag and drop the values from this panel and perform the computation there could have been like a data item. Let's say instead of five, there was a dynamic number that three number was there or any any data item with, let's say, of numeric type, let's say there is a data item called marks or like additional marks or something like that.
So we could have done this in brackets in these square brackets, in this we could have put in like student marks plus the additional marks or we could have simply dragged and dropped it here. Let's say just for an example sake, let's say we have these variables anything, we could have added the value of variable one. And in with the student marks, student dot marks, which is a part of the collection stored in the student mocks itself. And once it's again, I'm going to discuss this that it's a recommended practice once you use an expression always validate and see if it works or not, this one is valid. This one is valid because you know we have used numbers format and both these you know, like the collection field of marks is of numeric type. And same is the case with the numbers.
And you can see you can access the fields either through the collections data item, which is available here or through student Which is exactly the same thing this and this is exactly the same thing. But because these are text, so you will see student class and students dot name in the text option available in the data item types as well here, right, these are both the same thing, you can drag and drop any of those, it's not going to make a difference. But that's how we perform computations in data items or collections having any fields which also act as data items, collection of data items right. Okay. Next is execution control. There are several ways in which we control the execution flow of a program.
The regulated execution flow helps in analyzing the interactions BOD is making with any application, or any computation being performed by it, or any occurrence of an error and helps in debugging it as well. Several capabilities are incorporated Within the blue prism tool to assist in this process. So first we're going to talk about control play. Control play helps in controlling the execution speed of a program. It is available as a drop down menu, which is visible on the on clicking this arrow right next to the Go button within the control bar. So we have as of as of yet, I have kept it as a normal state so that we can see the process execution.
Right? We just went through this collections example. And if I put it in a normal speed, we've already seen it and put it as slow and you can change the speed during the execution or before the execution of the program as well. After it's not gonna make sense, right? So we reset it and let's try to run this I'm going to show this is under the very slow stage, right? So it's working very, very slow.
And you can see how the process is going on. It's right now executing the first row. If you go too fast. It went in pretty much one go We can also see a big difference if I add more values. Let's add a few more. Right.
I'm just putting any data here. Not a good practice, but just to show how it works. I'm gonna put in a few extra more values so that we have a bigger collection. And what's gonna happen is we have nine rows now, and if I put it as a fast speed like the fastest speed, we simply run it and you can see it went so fast, the whole execution and once you create the bots, you can imagine the efficient See, the bot is going to have, versus if you were doing this, you know, by retrieving each row one at a time, right. And if there were like 9000 900,000 rows, I'm sure it's gonna take you a couple of days versus a bot who can finish the same amount of computation in, in probably a matter of minutes. So that's how we change the execution, but we'll mostly keep it normal so that you know, it becomes comprehensible in the video itself.
The next that we are going to talk about is set next stage. So some there are times when you need to start your program from a particular stage. Like to jump without executing the previous stages. Say, I'm pretty much in a I've been performing this and I simply want to have fun This and there is some other steps that I've added right? And, or I want to start next from this stage, or from the start itself. Right, this might not be a perfect example.
But what you're gonna do is, you simply right click, and you put it as set next stage. So this, what it's gonna do is it the next stage from where process flow needs to execute is marked with the orange color, like this. Right, and now the process will start from here. And it started from the first row itself. You want to take a look at the process in between you wanted to, although there were three rows that were worked upon. So it's again, starting from the first row itself.
We didn't have to reset it. And there could have been more steps involved and we can, let's say, after this incrementation there were a few more computations and then Some let's say printing of result right you can simply go and set the next stage to the printing part and all the combinations between this looping statement and and the printing one, the printing operation, all those steps will be skipped and straightforward your printing operation will be performed. Right. Okay. Next is the breakpoint. a breakpoint is set onto a particular stage to pause the process flow to that point while executing.
So we usually set breakpoints for debugging a process flow to the point where the process flow worked perfectly fine. We set the breakpoint and process subsequent stages individually. Right, we may set multiple breakpoints in blue prism, as the program in hand may have severe complexity. To set a breakpoint, we simply right click on the stage and with the execution needs to be paused. Choose breakpoint. And the breakpoint is marked with as you can see, red outline border.
So let's say once we have restarted this, and we want as soon as the implementation operation starts or anytime this incrementation marks stage is executed, the process is gonna stop right there temporarily pause right. So let's try this every point was reached. So what happens is usually when we are debugging a program, if it is having throwing some sort of error, then we set the breakpoint to to that point in the process flow where we know for sure that our program is working fine. And then we go and execute the subsequent stages either step 111 stage at a time, or in some sort of snippets or some like a sequence of stages where we may put another breakpoint and keep continuing with the execution in the same way. So, you can have multiple breakpoints, like every time it is executed here, it's gonna temporarily hold the program.
Every time it comes, let's say any other stage, then we can put this one also as breakpoint, we can put multiple breakpoints in the process flow. All right, next, is stepping. Stepping is the process of executing one or a few combined together stages at a time. There are various capabilities provided within blue prism to step through the process. First is the step. Right, this option is used to execute one stage at a time.
So let's say we have set next stage let's remove the breakpoint. And this is where the program is gonna stick started shouldn't have mattered if even if I wouldn't have put As the SEC next stage because step is gonna start from the start stage itself if you have resetted the program. So what is going to do is the next stage won't be executed unless you click the same button again the step button. So one stage is being executed at a time. And in case the stage in our process flow is directing the program control to a business object, because we discussed it before, we have process to you and the business to do and we refer in the process to do in the process flow diagram, we reference to the business objects as well or we can reference to the multiple pages that we may have in the process as well.
So anywhere it is referencing, then the process is going to go to that stage and it is going to execute only one step at a time through the stepping process. Let's take a quick example for this. Otherwise, this might get a little bit cold. Next I'm gonna take example of page actually let me first create the page stick second page as well to the beach to just not a good bear game, let's probably make it logical that more comprehensible illegible sequence is very important because you know, you might be tempted to work in a in this ad hoc fashion. But in non projects with severe complexity, this might turn out to be a not a good way Just to show the functioning of step statement stage, this should be a fine example. So, what it's gonna do is, we'll be in here and we go through step three, see one stage will be executed at time.
Now, it is here at the page one, if we step it's, it's gone to the page one itself and one stage at a time. No matter if it is a business object or a page reference, only one stage will be executed using this capability. right every time you click, you get to execute the one stage. All right, next is the step over capability. This is used to execute a complete stage at once. So just to give a quick example, let's say one stage would be executed, like completely so this page one Right, using step, all the subsequent stages, which we have put in this page would be executed one by one, but through step over this whole page, or this whole stage would be executed at once in just one go.
Same as the case got to be with the start as well. So now we have this activity, we go to page one. Next, you see the page one got executed in a single click itself, there could have been multiple combinations. So that all got executed in like the fastest way possible. And similarly is the case with you see the step with the step we go to this page and we go through each and every stage. But using step over, we get to execute one complete stage at a time, no matter how much references into there could have been like page one might have been referencing, page two, page three, page five in some other videos as well.
Business Objects, it wouldn't matter using step over This whole stage would be executed in one single go. Right? All right, and the next one. And the last stepping technique is called the step out. Step out capabilities used to complete the execution of a current page. The process flow of business objects in one go.
All the underlying background activities within that page are processed with the maximum speed. Let's see how it works. If you go and click it here, it's straightforward just ended because everything all the nine rows were done in literally a matter of a fraction of seconds itself. Did you see how that worked? Let's show it again. Step out, right away.
I'll show you another quick example. Let's say we are stepping into page one right? We are here. If we click on the step out, we just stepped out and the whole page one got completed right away and it went to page If we go here and step out again, this whole page got executed in again, in just a few milliseconds. Right? So one complete page gets executed in a single click using the step out capability.
The last topic we're going to talk about in this chapter is logical process flow. As discussed in loops, the execution path of a program is not usually linear. It is convoluted with different flow structures through processes carried out via blue prism stages, data items, operational expressions, and other entities. In any programming language, it is advised to break a complex business operation into several simpler smaller operations. In blue prism, we divide the process flow into different pages, which are executed in a hierarchy. sequence in process studio, the first page that is executed in a program is the main page.
From main page itself, we may reference other pages, like page one and page two, which we also showed in the previous example. These pages in turn, made reference to other sub pages, forming the hierarchy. To add a page into the process to do, we right click on that tab. Let's show that. In here. We simply do and we add the new page.
Also, in the Edit option in the Edit within the menu bar, we have the Add New Page option available. Okay, just a quick thing to note that many times, developers tend to get occupied into a program that they start building logic for the complete process flow on the main page itself. For this, you can simply cut All the activities like this one or any activities, we can cut it or put it as Ctrl x. Like, we have these ones right, we simply cut them and we can paste them into a separate page. right because all the Ctrl C Ctrl V, pickpocket copy paste options, they are pretty much the same as any Windows application. They all are supported within the blue prism.
Another quick thing to remember is that while using cut paste options to divide the program into multiple pages, we need to remember the scope of data items. The data items used in one page may not be visible to other pages to increase their scope. Let's say in here we're incrementing the counter but the counter may not be visible. page one. So to increase the visibility of this data item, we go to the data item itself. And in here, we uncheck this hide from other pages in the process option.
And now, the page should be able to access the data item correctly and any computations can be involved in this page.