From the course: Complete Guide to UiPath RPA Development
Flowchart decision diamond - UiPath Tutorial
From the course: Complete Guide to UiPath RPA Development
Flowchart decision diamond
- [Instructor] In the previous video, we looked at the If/Else activity. In this video, let's check out the Decision Diamond, which as I said, is very similar to the If/Else. It's just that you can't use it in a sequence. It can only be used in a flowchart. One advantage of using flowcharts is that it can be easier to visualize what your logic is doing. Another advantage of flowcharts is that as you work through your logic, a flowchart allows you to return back to the top of the logic and start over again. You can't do that with sequences. The key thing to notice though is that each Decision Diamond has either a yes or a no, or a true and false branch. So let's go check that out. I've got my same project open from the previous video. I'll go into Activities and type in the word "decision." And there we see our flow decision. Notice when I grab that and try to drag it into a sequence, I get that blocking cursor. If I let go, nothing happens. So what that means is I've got to type in "flow" and grab a flow chart and drop that in here. Only once I expand the flow chart can I then go back and type in "decision" and grab that flow decision and drop it in here. So now when I hover over this flow decision, we see the true and false nodes up here, and those are going to allow me to use these connectors to connect to different branches of logic within the flowchart. Another difference between the flow decision versus the if is that in the if, we can place our condition right here on the activity, but with a flow decision, you've got to click on it first and then go into the Properties panel over here and place your condition there. So I'll type "what" and select What to Do again. So now that's the condition that's being evaluated to produce my true and false result. As you remember from the previous video, What to Do was set to false by this assign. So to wire all this up, I'll simply drag an arrow from my start node to my flow decision, and then I'll go down here to my If/Else and simply control C. And then click here and control V. And I'll double click and rename this to "True Branch." And I'll click on this one and control C, click up here and control V. And double click in here and change this to false branch. And these aren't really branches, they're just message boxes. But to make this work, I can simply click and drag from the true node to this one, and then hover and click and drag the false node to this message box. Now, I'll clean this up by clicking on my if block and deleting it. And now when I click Design, Run, my automation runs. I see it was false, and I can click Okay to finish the automation. Of course, if I change this to true and run again, now we see a dialogue from the true branch. So that's awesome. The last little nuance I'll talk about is when you click on Flow Decision, you can change the display name here to whatever you want, "Which Path to Take." So now when your business analysts are looking at your automation, it's fairly easy to see what it's going to do by looking at the workflow. Again, for me, flowcharts are a bit more complicated to work on than sequences, because instead of just being able to change the text of your message box on the activity itself, in a flow chart, you've either got to click on it and change the value over here, or you've got to double click to view and then change the value there and then jump backwards using this breadcrumb trail. So again, flowcharts have the value of allowing you to go backwards in your logic and also having nicer visual presentation. But that comes at the expense of being a bit more difficult to work with. And one last thing is, when I click on this Decision Diamond, notice over here in the Properties panel, I can change the labels of these branches. So for example, I could change that to yes, and this one to no. And now those changes visually show up here in the designer. Hope that helps.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.