studio
2021.10
false
Studio User Guide
Last updated Sep 23, 2024

Managing Variables

In Studio, variables are used to store multiple types of data. Another key aspect of variables is that their value can change so that you can, for example, control how many times the body of a loop is executed.

Note: Variables need to be created with different names, even if used in different scopes. You can check out our Workflow Design Naming Conventions recommendations.
From Studio's perspective, the variable's name is its unique ID and it defines the way it’s being displayed and used. If that changes or gets deleted, Studio is not able to interpret the .xaml files based on the loaded activities.
Important: If there are both a variable and an Managing Argumentsargument with the same name, the variable is always defaulted to and used at runtime.

The data stored within a variable is called a value, and it can be of multiple types. In UiPath, we support a large amount of types, ranging from generic value, text, number, data table, time and date, UiElements to any .Net variable type.

In Studio, all strings have to be placed between quotation marks.

Creating Variables

Note: Variables cannot be created if the Designer panel does not contain at least one activity.

From the Body of an Activity



  1. From the Activities panel, drag an activity to the Designer panel. Right-click a field and select Create Variable from the context menu, or press Ctrl+K. The Set Var field is displayed.
  2. Fill in the name and press Enter. The variable is created and visible in the field. Check its scope and type in the Variables panel.
From Expressions

Alternatively, variables can be created from expressions directly in an activity input field or the Expression Editor:

  1. Select a part of the expression and press Ctrl+K. The Set Var field is displayed.
  2. Fill in the name and press Enter. The variable is created. Check its scope and type in the Variables panel.



Variables created in these two ways automatically receive the type according to the activity. For example, if you create a variable in the Data Table field of a Write Range activity, the variable's type is set to DataTable. If you create a variable in the Text field of a Write Line activity, the variable's type is set to String.

The scope of such variables is the smallest container it is part of. The type is automatically generated depending on the selected property.

From the Properties Panel



  1. In the Properties panel of any activity, right-click a field that can be edited, and select Create Variable from the context menu, or press Ctrl+K. The Set Var field is displayed.
  2. Fill in the name and press Enter. The variable is created and visible in the field. Check its scope and type in the Variables panel.

The scope of variables created in this way is the smallest container it is part of. The type is automatically generated depending on the selected property.

From the Variables Panel



  1. In the Designer panel, click Variables. The Variables panel is displayed.
  2. Click the Create Variable line, and fill in the name. A new variable is created.

The default type of variables created this way is String.

Removing Variables

To remove a variable, in the Variables panel, either right-click the variable and select Delete, or select the variable and press the Delete key.



To remove all the variables that are defined in the Variables panel but not used anywhere in the current file, in the Studio ribbon, select Remove Unused > Variables, and then select Yes when prompted for confirmation. This also removes variables that are unused but mentioned in annotations.

Note: If you remove or upgrade a package that may lead to a variable or argument being undefined, an Unknown Type is added in its place so that the file can be opened and edited in Studio.

Browsing for .Net Variable Types

To search for types of variables that are not displayed by default in the Variable Type list, do the following:

  1. In the Variables panel, from the Variable Type drop-down list, select Browse for Types. The Browse and Select a .Net Type window is displayed.
  2. In the Type Name field, type a keyword for the variable you are looking for, such as excel. Note that the result section is updated, displaying all the .Net variable types that contain your keyword.
  3. Select one and click OK. A new variable is created with the selected type and is displayed in the Variables panel.



    Note: After first using a type of variable from the Browse and Select a .Net Type window, it is displayed in the Variable Type drop-down list, in the Variables panel.

Variable and argument types part of assemblies proprietary to Studio or Robot are hidden. Workflows that reference types from such assemblies should not be affected at runtime. To use a type from a non-.Net framework assembly, add it as a dependency to your project with the help of the Manage Packages window.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.