MODULE-2: Sequence, Flowchart, and Control
Flow and Data Manipulation
Sanjeela Sagar
[Link]@[Link]
Vidyalankar School of
Information Technology
Wadala (E), Mumbai
[Link]
Certificate
This is to certify that the e-book titled “Sequence, Flowchart, and Control Flow and
Data Manipulation” comprises all elementary learning tools for a better
understating of the relevant concepts. This e-book is comprehensively compiled
as per the predefined eight parameters and guidelines.
Signature Date: 07-08-2024
Sanjeela Sagar
Assistant Professor
Department of IT
DISCLAIMER: The information contained in this e-book is compiled and distributed for
educational purposes only. This e-book has been designed to help learners understand
relevant concepts with a more dynamic interface. The compiler of this e-book and
Vidyalankar School of Information Technology give full and due credit to the authors of the
contents, developers and all websites from wherever information has been sourced. We
acknowledge our gratitude towards the websites YouTube, Wikipedia, and Google search
engine. No commercial benefits are being drawn from this project.
Unit II
• Contents
Sequence, Flowchart, and Control Flow: Sequencing the workflow, Activities, Control
flow, various types of loops, and decision making, Step by-step example using
Sequence and Flowchart, Step-by-step example using Sequence and Control flow
Data Manipulation: Variables and scope, Collections, Arguments – Purpose and use,
Data table usage with examples, Clipboard management, File operation with step-by-
step example, CSV/Excel to data table and vice versa (with a step-by-step example)
Recommended Books
• Text Books And Reference Books
Prerequisites Linkage
Unit I
Sem. I Sem VI
Learning Robotic Programming Project
Process Logic
Automation
Unit II
• Sequence, Flowchart, and Control Flow: Sequencing the workflow, Activities,
Control flow, various types of loops, and decision making, Step by-step example
using Sequence and Flowchart, Step-by-step example using Sequence and Control
flow.
• Data Manipulation: Variables and scope, Collections, Arguments – Purpose and use,
Data table usage with examples, Clipboard management, File operation with step-by-
step example, CSV/Excel to data table and vice versa (with a step-by-step example).
Q.1 What is sequence? Create a sequence that asks for a name of the user and
then displays his or her response.
A Sequence is a group of logical steps. Each step represents an action or a piece of
work. A Sequence is used for processes that happen in linear succession, that is,
one after the other. Among the three types of projects in UiPath, Sequences are
the smallest. An illustration of how to build a Sequence in UiPath Studio.
Example:
Open UiPath studio, click on Process under New Project.
A window pops up name it and click Create.
Main Workflow opens a blank page.
Under ‘Design’ tab in ‘New’ select ‘Sequence’.
A window pops up click on Create.
Sequence blank page opens.
In the Activities Panel search Input Dialog and drag in inside sequence.
In Variable panel type name variable type as string and the scope as the flowchart
we created earlier and keep the default value as such.
Under Input label type (“type in quotes”) “What is your name”; in Value entered
put the variable which is created earlier i.e., name.
Drag and drop Message Box from activities Panel to workflow under input dialog
to display output/message(“write in quotes”)
Under design tab in debug file click on run file to execute the workflow
The output
Q.2 What is activity? Give an example to demonstrate the use of activity in a
workflow.
An activity represents the unit of an action. Each activity performs some action.
When these activities combine together, it becomes a process.
Using activities with workflow:
Example:
Click on process create it; click on Open Main workflow, in the activities panel
search flowchart & drag it and under flowchart drag write line activity (“write in
quotes”) “hi”.
Q.3 What are Flowcharts and when to use them?
A Flowchart is generally used for complex business processes. It provides decision-
making facilities and can be used for both small and large projects.
A Flowchart provides multiple branching logical operators to make decisions.
A Flowchart is able to run in reverse.
Also, it can be used inside Sequences.
A Flowchart facilitates reusability for distinct projects.
A Flowchart's branches are set to true/false by default. However, its names can be
manually changed from the Properties panel.
Example:
First, add a Flowchart from the Activities panel into the Designer panel.
Add a Sequence activity within the Flowchart.
Take two Input dialog activities (for entering the numbers to be added) inside the
Sequence activity.
Create the variables x and y to save the values.
Next, add a Message box activity to perform a mathematical operation. In our case,
the sum of the two numbers is less than 20:
Now, add a Flow Decision activity to check the mathematical operation.
If true, the Flow Decision will flow toward the true branch. Otherwise, it will flow
towards the false branch.
Q.4 What are the different types of control flow activities available in UiPath
Studio? Explain any two.
Control flow refers to the order or the particular manner in which actions are
performed in an automation. UiPath provides numerous activities for performing
the decision-making process. These activities, present in the Activities panel, are
put into the workflow either using the double-click method or the drag and drop
method.
Different types of control flow activities are as follows:
• The Assign activity
• The Delay activity
• The Break activity
• The While activity
• The Do While activity
• The For each activity
• The If activity
• The Switch activity
Explanation of two activities:
1. Assign activity:
The Assign activity is used to designate a value to the variable. The Assign activity
can be used for different purposes, such as incrementing the value of a variable in
a loop, or using the results of a sum, difference, multiplication, or division of
variables and assigning it to another variable.
2. Delay activity:
The Delay activity, as the name suggests, is used to delay, or slow down an
automation by pausing it for a defined period of time. The workflow continues after
the specified period. It is in the hh:mm:ss format. This activity plays a significant
role when we need a waiting period during automation, perhaps say, a waiting
period required for a particular application to open.
Q.5 What is assign activity? What is the use of it?
The Assign activity is used to designate a value to the variable. The Assign activity
can be used for different purposes, such as incrementing the value of a variable in
a loop, or using the results of a sum, difference, multiplication, or division of
variables and assigning it to another variable.
“Assign” activity is used whenever you need to assign a value to a variable or
update the value of a variable during the execution of the workflow.
Example:
We can use the “Assign” activity to assign a constant value to a variable. For
example, if you want to set a variable named “myString” to the value “Hello,
world!”, you can use the “Assign” activity with the following syntax: myString =
"Hello, world!"
Q.6 What is Delay activity? Where is it used? Explain with an example.
The Delay activity, as the name suggests, is used to delay or slow down an
automation by pausing it for a defined period of time. The workflow continues after
the specified period of time. It is in the hh:mm:ss format. This activity plays a
significant role when we need a waiting period during automation, perhaps say, a
waiting period required for a particular application to open.
Example:
To better understand how the Delay activity works, let us see an example of an
automation that writes two messages to the Output panel with a delay of 50
seconds.
Perform the following steps:
1. First, create a new Flowchart.
2. Add a Write line activity from the Activities panel and connect it to the Start
node.
3. Select the Write line activity. Now, type the following text into the Text box:
“Hey, What is your name?”.
4. Next, add a Delay activity and connect it to the Write line activity.
5. Select the Delay activity and go to the Properties panel. In the Duration field, set
[Link]. This is a 50-second delay between the two logged messages.
6. Take another Write line activity and connect it to the Delay activity. In the
Text field, write “My name is Andrew Ng.”
7. After clicking on the Run button, the output panel shows the message that delays
it by 50 seconds:
Q.7 What is break activity? With which loop is it used? Explain.
The Break activity is used to break/stop the loop at a particular point, and then
continue to the next activity according to the requirement. It cannot be used for
any other activity apart from the For each activity. It is useful when we want to
break the loop to continue to the next activity in the For each activity.
Example:
In this example, we will use the Break activity to execute only one iteration.
Perform the following steps:
1. Add a Sequence activity to the Designer panel.
2. Next, add a For each activity inside the Sequence (as mentioned in the preceding
section, to use the Break activity, we need the For each activity):
3. Create two variables; an integer variable named JUFN, and an array integer
variable named Y. Then, set them to the text field.
4. Now, assign a default value to the integer variable Y. 5. Add a Break activity inside
the body of the loop.
5. Under the For Each activity, add a Write line activity. 7. In the Write line activity,
type [Link] in the text field.
6. When we click the Run button, it will display one element, as shown in the
following screenshot. This is due to the Break activity, which has stopped execution
after the first iteration:
Q.8 What are the differences between while and do..while activity?
The While activity is used in automation to execute a statement or process based
on a certain condition. If found true, the loop is executed; that is, the process is
executed repeatedly. The project only exits from the loop when the condition does
not hold true. This activity is useful while iterating through an array of elements.
Example:
In the following example, we will see how an integer variable will increase from 5
to 50 in increments of 5.
Perform the following steps:
1. On a Blank project, add a Sequence activity.
2. Now, create an integer type variable Y. Set its default value to 5.
3. Next, add a While activity to the Sequence.
4. In the condition field, set x<50.
5. Add an Assign activity to the body section of the While loop.
6. Now, go to the Properties panel of the Assign activity and type in the text field
integer variable for value field integer x+5.
7. Drag and drop a Write line activity and specify the variable name Y and apply
ToString method on this variable:
[Link], click the Run button. The output will display in the Output panel, as shown
in the following screenshot:
The Do while activity is used in automation when it is required to execute a
statement based on the fulfillment of a certain condition. How it differs from the
While activity is that it executes a statement, then checks whether the condition is
fulfilled. If the condition is not fulfilled, it exits the loop.
Example:
Let us take an example to understand how the Do while activity works in
automation. Take an integer variable. Starting with this variable, we shall generate
all multiples of 2, less than 20.
Perform the following steps:
1. Add a Sequence to the Designer panel.
2. Add a Do while activity from the Activities panel.
3. In the body section of the Do while activity, add an Assign activity.
4. Now, select the Assign activity. Go to the Properties panel and create an integer
variable Z. Set its default value to 2.
5. Set y+2 in the value section of the Assign activity to increment the result each
time by 2 until the loop is executed.
6. Add a Write line activity inside the Assign activity.
7. In the text field of the Write line activity, type y.
8. In the condition section, set the condition y<20. The loop will continue until the
condition holds true:
9. On clicking the Run button, the output displayed will be as follows:
Q.9 What is ForEach activity? Where is it used? Why is it important?
The For each activity works by iterating each element from the collection of items
or list of elements, one at a time. In the process, it will execute all the actions that
are available inside the body. Thus, it iterates through the data and processes each
piece of information separately.
Example:
In the following example, we shall use the For each activity to go through a
collection of even numbers and display each element one at a time. Perform the
following steps:
1. Start with a Blank project in UiPath.
2. Add a Sequence activity to the Designer panel.
3. Next, add a For each activity within the Sequence and create an integer type
array variable, x.
4. In the default value of the variable, put in (2,4,6,8,10,12,14,16,18,20).
5. Add a Write line activity to the Designer Panel (this activity is used to display the
results).
6. In the Text field of the Write line activity, type [Link] to display the
output:
7. Now, run the program. You will see that each number of the array is displayed
one by one because of the use of the For each activity:
Q.10 What are the decision-making statements available in UiPath Studio?
Explain.
In UiPath Studio, decision-making statements are essential constructs that allow
you to control the flow of your automation based on specific conditions. These
statements enable your robots to make choices and take different paths in the
workflow, depending on the values of variables or the outcome of comparisons.
The primary decision-making statements available in UiPath Studio are:
• If activity: The "If" activity is used to implement a simple conditional statement.
It evaluates a specified condition and executes different sets of activities based
on whether the condition is true or false.
• Switch activity: The "Switch" activity is used when you have multiple possible
outcomes based on the value of a single expression. It compares the expression
against different cases and executes the activities associated with the matching
case.
• Select Case activity: Similar to the "Switch" activity, the "Select Case" activity is
used to compare a single expression to multiple cases. It's particularly useful for
performing a specific action based on different values of the expression.
• While activity: The "While" activity is used for creating loops that continue as
long as a specified condition is true. It's suitable for situations where you want
to repeat a set of activities until a particular condition is no longer met.
• Do While activity: Similar to the "While" activity, the "Do While" activity also
creates a loop based on a condition. However, the activities inside the loop are
executed at least once, even if the condition is initially false.
Q.11 What is Switch activity? Where we can make changes to get the desired
argument type in switch activity. Explain with an example.
The Switch activity enables you to select one choice out of multiple, based on the
value of a specified expression.
By default, the Switch activity uses the integer argument, but you can change it
from the Properties panel, from the TypeArgument list.
The Switch activity can be useful to categorize data according to a custom number
of cases. For example, you can use it to store data into multiple spreadsheets or
sort through names of employees.
To exemplify how to use the Switch activity, we are going to create an automation
that asks the user for a number, checks if is odd or even, and depending on that, a
different message is written to the Output panel.
Since all odd numbers divided by two have a remainder equal to 1, this project
needs only two cases (0 and 1), yet keep in mind that this activity supports multiple
cases.
1. Create a new sequence.
2. Create an integer variable, Number.
3. Add an input Dialog activity to the Designer panel.
4. Add a Title and Label to prompt the user for a number.
5. In the Result field, add the Number variable.
6. Add a Switch activity, under the Input Dialog.
7. In the Expression field, type Number mod 2. This verifies if the user’s number is
divisible by 2.
8. In the Default section, add a write line activity.
9. In the Text field, type [Link] + " is an even number.".
[Link] the Add new case line, and in the Case Value field, type 1.
[Link] a Write Line activity to this case.
[Link] the Text activity, type [Link] + " is an odd number.".
Q.12 How to use a sequence?
There may be different Sequences doing their jobs. We can easily put similar
Sequences into a workflow; each workflow represents a task.
It is very easy to test a separate workflow alone. Let us try to understand them
better with an example.
Perform the following steps:
1. Drag and drop a Flowchart onto the Designer panel. Drag and drop a Sequence
activity. Connect the Sequence activity with the Start node.
2. Double click on the Sequence activity. Drag and drop an Input dialog activity and a
Message box activity. Specify a message in the label property of the Input dialog
activity.
3. Create a variable of type String. Give it a name. Also, specify this newly created
variable's name in the content property of the Message box activity.
We can see clearly that we have used two activities inside the Sequence that are
logically related (one for inputting the name and the other for popping it up).
Here, the Sequence contains two activities. Of course, you can put as many activities
as you want inside the Sequence; it will be executed according to the order in which
you have defined.
Q.13 How to use a flowchart?
Previously, we have seen how to use a Sequence and activities. We shall now learn
how to use a Flowchart.
A Flowchart is a container. It can contain activities inside it. I order to use email
activities in example please install [Link].
You can find it by clicking on Manage package icon or pressing Ctrl + P and search for
mail in all package.
Let us drag and drop a Message box activity inside the Flowchart. Double click on the
Message box and type in the area where the text is to be quoted. Press F5 to see
the result.
Q.14 When to use a sequence or a flowchart? Explain with a demonstration.
Sequences are the smallest type of project. They are suitable to linear processes as
they enable you to go from one activity to another seamlessly, and act as a single
block activity. One of the key features of sequences is that they can be reused.
Flowcharts can be used in a variety of settings, from large jobs to small projects
that you can reuse in other projects. The most important aspect of flowcharts is
that, unlike sequences, they present multiple branching logical operators.
Q.15 What is a variable? What are the different types of variables available in
UiPath?
A variable is the name that is given to a particular chunk of memory cells or simply
a block of memory and is used to hold data.
You can declare any desired name and create a variable to store the data. It is
recommended, however, that we use meaningful variable names. For example, if
we wish to create a variable to store the name of a person, then we should declare
A variable is used to store data. Data is present around us in different types. It can
be an mp3 file, text file, string, numbers, and so on.
That is why variables are associated with their respective data types. A particular
type of variable can hold only that type of data.
If there is a mismatch between the data and the variable type, then an error occurs.
The following table shows the type a of variable available with UiPath:
Q.16 What is Argument? What is the purpose and use of an argument?
An Argument is simply a variable that can store a value. You can create an argument
in the Argument section of the main Designer panel.
But remember, they are not limited to variables. An argument has a larger scope
than a variable and is used to pass values between different workflows.
You might be wondering why we need this. Suppose we have a big project to build;
we break down the project into different workflows because smaller workflows can
be easily tested separately.
It is very easy to build smaller workflows and combine them, thus turning them into
the real solution of the project.
These Arguments are used for interacting with different workflows by exchanging
data between them. That is why the direction property is associated with
Arguments.
We can choose the direction on the basis of our requirement either giving the value
to some workflow or receiving the value from another workflow
Q.17 What are the different types of directions available for an argument?
Explain.
There are four types of directions available for an argument. These are:
1. In: When we have to receive the value from another workflow.
2. Out: This is the current value if we have to send the value to a workflow.
3. In/Out: This specifies both; it can take or receive the value.
4. Property: This specifies that it is not being used currently.
Q.18 Differentiate between a variable and an argument?
Variable:-
• A variable is the name that is given to a particular chunk of memory cells or
simply a block of memory and is used to hold data.
• You can declare any desired name and create a variable to store the data.
• It is recommended, however, that we use meaningful variable names. For
example, if we wish to create a variable to store the name of a person, then we
should declare it as string.
• It is a good practice to create meaningful variable names. This becomes very
useful in debugging the program.
• As we discussed, a variable is used to store data. Data is present around us in
different types. It can be an mp3 file, text file, string, numbers, and so on.
• That is why variables are associated with their respective data types. A particular
type of variable can hold only that type of data. If there is a mismatch between
the data and the variable type, then an error occurs.
• The following table shows the type a of variable available with UiPath:
• In UiPath, we can declare a variable in the Variables section. Just give it a
meaningful name and select the appropriate type from the drop-down list.
Argument: -
• Arguments are used to pass data from a project to another.
• In a global sense they resemble variable as they store data dynamically
• Variable pass data between activities while argument pass data between
automations
• Argument aims to gain adherence from an audience.
• We can easily create arguments in the Arguments panel. We can also specify
the direction.
Q.19 What is Data table? What are the different methods to create a data table
in UiPath?
• A data table is a tabular form of data structure. It contains rows and each row
has columns.
• A data table is used for various purposes. Say, for example, you have to build a
table dynamically.
• You can use a data table as your preferred choice. A data table is also extensively
used to store tabular data structures.
• In data scraping, data tables are widely used. Data scraping is a method in which
we can dynamically create tabular data records of search items on the web.
• Click on the Data Table button. A pop-up window will appear on the screen.
Remove both the columns.
• Using data scraping, we can build the data table at runtime.
Q.20 How you can build data table using data scraping? Explain its process.
Using data scraping, we can build the data table at runtime. Let us consider an
example of extracting data from Amazon's website. Perform the following steps:
1. Drag and drop the Flowchart activity from the Activities panel and drag and drop
the Sequence activity inside the Flowchart activity.
2. Double-click on the Sequence activity.
3. Drag and drop the Open Browser activity inside the Sequence activity. Specify the
URL in the text box:
4. Click on the Data Scraping icon on the top left corner of UiPath Studio. A window
will pop up. Click on the Next button.
5. Now, there will be a pointer pointing to the UI elements of the web page. Click on
the name of the book
It will ask you to point to a second similar element on the web page:
1. Point to a second similar element on that web page. Specify the name that
you want to give for that extracted data column. (It will become the column
name of the extracted data). Click on the Next button. 7. A list of names will
appear in a separate window
2. If you want to extract more information, then click on the Extract correlated
data button and repeat the same process once again (just as we extracted
the name of the book from Amazon's website). Otherwise, click on the Finish
Button
3. It will ask you to locate the next page's button/link. If you want to extract
more information about the product and it spans across multiple pages, then
click on the Yes button and point to the next page's button/link. Then, click
on it. If you want to extract only the current page's data, click on the No
button, (you can also specify the number of rows that you want to extract
data from: By default it is 100)
4. Data scraping generates a data table. (In this case, &YUSBDUFE%BUB5BCMF
is generated.) Change the scope of &YUSBDUFE%BUB5BCMF to the
Flowchart so that it is accessible within the Flowchart activity:
5.
Q. 21 What do you mean by clipboard management? Explain with an example.
Clipboard management refers to the process of controlling and manipulating the
contents of the clipboard in a computer or digital device. The clipboard is a
temporary storage area where data that has been cut or copied is stored
temporarily before it is pasted elsewhere. Clipboard management involves tasks
such as copying, cutting, pasting, and organizing data on the clipboard.
Q.22 What types of methods are frequently used with Excel? Explain.
Excel is a powerful spreadsheet software that offers a wide range of methods and
functionalities to perform various tasks. Here are some frequently used methods
in Excel along with explanations:
Examples:
• Read Cell
• Write Cell
• Read Range
• Write Range
• Append
These are just a few examples of the many methods and features available in Excel.
Q.23 How will you extract data from an excel file into data table and vice versa?
Explain with an example.
Graded Questions
Q.1 What is sequence? Create a sequence that asks for a name of the user and
then displays his or her response.
Q.2 What is activity? Give an example to demonstrate the use of activity in a
workflow.
Q.3 What are Flowcharts and when to use them?
Q.4 What are the different types of control flow activities available in UiPath
Studio? Explain any two.
Q.5 What is assign activity? What is the use of it?
Q.6 What is Delay activity? Where is it used? Explain with an example.
Q.7 What is a break activity? With which loop is it used? Explain.
Q.8 What are the differences between while and do. While activity?
Q.9 What is For Each activity? Where is it used? Why is it important?
Q.10 What are the decision-making statements available in UiPath Studio?
Explain.
Q.11 What is Switch activity? Where we can make changes to get the desired
argument type in switch activity. Explain with an example.
Q.12 How to use a sequence?
Q.13 How to use a flowchart?
Q.14 When to use a sequence or a flowchart? Exaplain with a demonstration.
Q.15 What is a variable? What are the different types of variables available in
UiPath?
Q.16 What is Argument? What is the purpose and use of an argument?
Q.17 What are the different types of directions available for an argument?
Explain.
Q.18 Differentiate between a variable and an argument?
Q.19 What is Data table? What are the different methods to create a data table
in UiPath?
Q.20 How you can build data table using data scraping? Explain its process.
Q.21 What do you mean by clipboard management? Explain with an example.
Q.22 What types of methods are frequently used with Excel? Explain.
Q.23 How will you extract data from an excel file into data table and vice versa?
Explain with an example.