In Moder world, UiPath or other RPA tools provides a vital part in automating repetitious and tedious tasks to make them easier and more accurate, and more effective for business processes. While using UiPath you’ll need to use UiPath variables. Variables are used to store data which allow you to manipulate and can be used on different processes.

On this page, we are going to take you on a trip to discover the power of UiPath Variables. You will learn all about what they are, the different types available, and how to use them in your automation process. So get ready to start your Automation process with Variables.

What are UiPath Variables

Variables are storage spaces that can be used to hold multiple data entries( values) of the same data type. In Uipath Variables are used to store values that they can use later or across their automation Process. All variables are unique which means you cannot create two variables of the same name. For Example:

EmailAddress can be a variable that holds the value “sample@rpatutorials.com”. like these, variables can be used to store multiple values such as Name, Age and etc.

The value of each variable can be changed through an external input, data manipulation, or passing from one exertion to another and each variable is unique

Properties of UiPath Variables

Now let’s understand some of the properties of variables.

UiPath Variables Properties
UiPath Variables Properties
PropertiesDescription
Name Names are used to describe a variable or set a name for a variable so that the next time you want to use this variable, it can be called with the help of this name.

➤ Using PascalCase is recommended for variable names. It means that the first letter of each word is capitalized. Such as FirstName, AccountNo, StrOutptu, etc.
➤ Giving a meaningful full name helps you to understand what is the purpose of it throughout your automation process
Variable TypeThe variable type describes the data type of variables stored. For both numbers and Text values there cannot be the same data types of each of them, as one indicates a number and the other indicates a sting. The Some of data types used in variables are:

Array of [T]: Used to store array values.
Boolean: It is used to store True or False values.
Int32: Used to store numeric values.
Object: Objects are used to store multiple data types.
String System.Data.DataTable: It is used to store large information such as table data, spreadsheet data, etc.
Browse for Types
scopeA variable’s scope is determined by its workflow name in an automation project. It can be used in that workflow and its children’s workflows. In UiPath, a variable’s scope is limited to its defined workflow. This is a mandatory field you cannot avoid this or keep this null.
DefaultDefault values are stored in variables so that if you didn’t add or pass any values it automatically adds the default values to its variable. This field is not mandatory.

How to Create Variables in UiPath Studio

You can create or declare a variable by following any one of the below methods in your uipath studio:

1. From the Variables Panel

You can easily declare variables from the variable panel:

  • Click on the Variable section.
  • Now click an empty field to make a new variable in your uipath studio.
Create Variables from Panel
Create Variables from Panel

2. By Right Click In the Input Field of an Activity

You can declare a variable directly within the activity in uipath studio:

  • Click an activity in which you want to create a variable.
  • Right-click and select “create a variable” to create a variable and set its datatype, scope, and default value.
Create Variables in Uipath Studio
Create Variables in Uipath Studio

3. By using a Keyword Shortcut

You can also create variables using keyboard shortcuts such as Ctrl + K

  • Click on the text field of any activity
  • Then press Ctrl + K and now you can see “Set Var” and type your variable name to set it as a variable.

Types of UiPath Variables

As now you have familiarised yourself with variables, now we will go through UiPath Variable types of variables used in UiPath for your automation process.

  • Number Variables
  • Text Variables
  • Array Variables
  • True or False Variables
  • Data Table Variables
  • Date and Time Variables
Data Types in UiPath Studio
Data Types in UiPath Studio

Text Variables

A UiPath variable in String or text is used to store values that are in the form of text or string. These variables are able to store values such as user names, employee names, or any other string queries. Example:

NameVariable TypeScopeDefault
FirstNameStringMainEnter a VB Expression
SecondNameStringMainEnter a VB Expression

True or False Variables

This variable is also known as a boolean variable. It can store two values either False or True. This variable helps you to make a decision Flowchart. Example

Sample_Number=30
if Sample_Number greater than or equal to 0 ---> "Positive Number " ( Statement is True )
If Sample_Number Less than o --> "Negative Number " ( Statement is False)

Number Variables

This variable is also known as int32 or Integer variable. This variable is able to store numeric values. Example: Age, Year, etc.

NameVariable TypeScopeDefault
AgeInt32Main“21”
YearInt32Main“2025”
  • Int32: Used to store values like 10, 45, 89
  • Long: Used to store values like 10, 45, 89
  • Double: Used to store values like 10, 45, 89

Array Variables

Array Variables are able to store more than one value in a single variable. It can have multiple subfields and each field has its own values. In Array variables, you have to choose which data type values are used in these variables.

NameVariable TypeScopeDefault
FirstNameStringMainEnter a VB Expression
SecondNameStringMainEnter a VB Expression

Date and Time Variables

UiPath Variable date and TIme variable allow you to store values of dates and times. Dates are in “dd/mm/yyyy” (Date/Month/Year) format and Times are in “hh:mm: ss” (Gour:Minute: Second) this format

Data Table Variables

Data Table Variables are mainly used to store a large number of values. These are used in web scrapping, excel automation to store multiple data in rows and columns. These variables have the capacity to store huge values compared to other variables.

NameVariable TypeScopeDefault
ExcelValuesData TableMainEnter a VB Expression

Proprietary Variables

  1. GenericValue Variables: Generic value variables in uipath can store values of data including numbers, text, dates, and arrays. These variables are automatically converted to other datatypes based on their requirements. So you don’t need to use data type conversion methods and uipath global variables.
  2. QueueItem Variables: These variables are able to store queue items in uipath studio.

Browser Variables

UiPath Browser Variables are the variables used in browsers to store values in web automation. To create a browser variable you can either use the variables panel or use a keyboard short key. You can use browser variables to set input and output values.

UiPath Variables Data Type Conversion

As now you have familiarized yourself with uipath data types now we will check if you can convert from each datatype to another datatype that can be used on your uipath automation. During automation, there may be some cases where you have received incorrect datatype values, so in that use case, you can use these conversion methods.

ConversionDescription
Convert.ToString MethodThis method allows you to convert the specific value to a string. Example:
Str_Var = Convert.Tostring(Int_Var) Here Int_Var is converted to a string and stored in Str_Var
Convert.ToInt32This method allows you to convert to a 32-bit integer. Example:
Int_Var = ToInt32(Str_Var) Here we will convert the Str_Value to integer and store in Int_Var
Double.ToString MethodThis method allows you to convert a numeric value to a string value. Example: Str_Var = Dbl_Var.ToString 
Double.Parse MethodThis method is used to convert the Input string of a given number to a floating point number (double). Example:
 DblVar = Parse(StrVar) 
Boolean.ToString MethodThis method can be used to convert a specific value to an equivalent string value that is either true or false.
Example: ToString()
Convert.ToBoolean MethodThis method can convert a specific value to a Boolean value that is either true or false.
Example: ToBoolean(Int32)
Convert DateTime to StringThis method can be used to convert specific date or time to a string value
Example: Now.ToString(“dd-MM-yyyy”) or DateTimeVar.ToString(“dd-MM-yyyy”)

Conclusion

Till now we have discussed UiPath Variable Scope, and also check how to perform data type conversion in your uipath studio. You can use these variables in UiPath Studio to store values such as list, string, date, double and null, or empty values.

Also refer, UiPath Official

Faq in UiPath Variables

  1. What are the variables in UiPath?

    UiPath Variables are used to store specific values in your uipath automation. It can be an integer, string, boolean, or data table.

  2. What are the 4 types of variables in UiPath Categorised into?

    The different types of variables in uipath are Boolean, Int32, String, Object, and Data table.

  3. How do I set variables in UiPath?

    You can easily set variables in UiPath by using the variable panel or you can use the keyboard short keyu003cstrongu003e Ctrl + K u003c/strongu003ein the activity text box.