Introduction To Flowcharts In UiPath (RPA) And Create A Number Guessing Application

We will discuss about the Flowcharts in UiPath and how to control the application flow. We will create a simple number guessing game application with Flowchart.

This is my third article on UiPath. I have already explained the basics about UiPath in my previous articles. “Sequence” and “Activity” are key concepts in UiPath. Please refer to my below articles to get started with UiPath and RPA.

So far, we created projects using “Process” type only. In this article, we will discuss the Flowcharts in UiPath and how to control the application flow. We will create a simple number guessing game application with Flowchart.

Create a UiPath Project with Transactional Process type

The most important aspect of flowcharts is that, unlike sequences, they present multiple branching and logical operators, that enable you to create a variety of business processes and connect the activities in multiple ways. Flowcharts can be used in large projects to small projects that can be reused in other projects as well.

We can create a new project now. We will create it as “Transactional Process” type.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
You can give the project name and description. Also, select the location to save the project.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
You can click the “Create” button to create a new project. It will take a few moments to initialize the project dependencies. The project is created with a default flow diagram.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application  

We can remove all the activities from this default flowchart.

In this example project, we will check if a year is a leap year or not. We can get a year value from input dialog box and check the year using “Flow Decision” activity. This “Flow Decision” activity has both a “True” part and a “False” part. If the mod value of the year is zero, the year is a leap year; otherwise not.

We can drag an “Input Dialog” to the work area and give “Title” and “Label” values to this activity.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can create a variable and select integer as a data type.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can assign this variable in the “Result” property of “Input Dialog” activity.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can connect the Start button with Input Dialog. Now, our first flow is created. We can add more flows to this flowchart.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
We can add a “Flow Decision” activity to work area and link with flowchart.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
We can link this activity to “Input Dialog” activity.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
We can add the condition to “Flow Decision” activity. We will check the variable’s mod with four. If the mod is zero, the year is a leap year. Otherwise, it is not a leap year.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 

As I mentioned earlier, “Flow Decision” has both a “True” part and a “False” part. We will add Message Box to both conditions.

First, we can add a message to the True condition.

Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can link previous “Flow Decision” activity with this Message Box.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
We can add one more Message Box for False condition and link with Flow Decision activity.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
We have completed all the activities for checking given year value is a leap year or not. The entire flowchart looks like below.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 We can run the project.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
If you give the year like 2018, you will get the below message.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
If you give the year like 2020, you will get the below message.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We have seen the usage of Flowchart in the above example. We can see one more example now. We will delete all the existing activities from this project and add new activities to the project.

Modify current project as number guessing the application

We can assign a random number to a variable and get a value from the user. We will check this input value with the above variable and if the values are the same, it will show the message box and exit the application. Otherwise, the system will again check which value is greater and which value is lesser and show the corresponding messages. Again, continue the process and get a new value from the user. If the new value does not match, repeat the process again. The process will end only after the user gives a correct value which will match with a random number, which we have already kept in the variable.

We can start the flowchart.
 
First, we will create a variable and assign a random number to this variable

We can use “Assign” activity for this purpose. Please drag this activity and assign a variable to it.

Flowcharts in UiPath (RPA) and Create a Number Guessing Application
 
We can create a random number and assign this to the Value property of our “Assign” activity. We can use below expression for that.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 

We have assigned a random value from 0 to 50. We can add “Input Dialog” to guess the user a number between 0 and 50 (You can change it to any random number).

Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can assign Result property with a new variable.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can add a “Flow Decision” activity and check random number with user input.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 

We can add a message box for True part of the Flow Decision. If the user guesses a value which is equal to a random number, it will show a successful message.

So far, our flowchart looks like below. We must add a few more activities.

Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can create a new variable for counting the number of attempts, that user takes for guessing the correct value.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
We can add an “Assign” activity to set increment of the above variable.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
We will add one more “Flow Decision” activity to check if the user guesses a value which is greater than the random number or not.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
If the random number is greater than guessed value, it will show the below message.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
If the random number is lesser than guessed value, it will show the below message.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 

After showing above messages, the process will again ask the user to guess a new value and repeat all these flows again until the user guesses the correct value.

We have completed all the flowcharts. The entire flow looks like below.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 

We can run the project now. User can enter a value between 0 and 50.

I have given the value as “30”.

Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 
It will immediately show the below message.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application 
 

It will ask one more input value again.

I have given another value, “20,” now.
 
Flowcharts in UiPath (RPA) and Create a Number Guessing Application  

Now we can analyze that the random number falls between “21” and “29”.

We can try any number between these two numbers. After a few more guesses, I found the exact number. 

Flowcharts in UiPath (RPA) and Create a Number Guessing Application 

Please note, we have got the total number of guesses from the counter variable which we have used in our project.

In this article, we have discussed about flowcharts in UiPath and we have seen two simple examples also. I hope you have got a good idea about flowcharts now. It is a very important component in UiPath.
 
We will see more important features of UiPath in upcoming articles.