Variables and Arguments

Variables and Arguments

Variables and Arguments are the main components of UIPATH development. It’s very difficult to imagine any of the development without using these components. They help with how data is collected, stored, processed, and passed between various activities and workflows, whereas Control flow is how the activities are executed throughout the process.

We will start by exploring how variables help us to store, process, collect and pass data within a workflow. Next, we will learn about how arguments and the invoke workflow activity help us pass data between workflows. Lastly, we will check out how we can use the, while, do while, for each, switch and parallel activities to control the order in which activities are executed within a process.


What are variables?

Variables are containers that can hold multiple data values of the same data type.

For Example: – Phone Number can be a variable that holds the value of “1234567891”.

The value of a variable can change through external input, anti-manipulation or passing from one activity to another.

What is the importance of variables in automation process?

Variables help us pass data from one activity to another. A value passing to the variable can travel through the end of the process. Any automation process would hardly be possible without using variables.

Different properties of Variables:

Variables are configured through their properties and can be set in the variables panel. The main properties in UiPath are: –

Different properties of variable

Name: – The Variable’s name is the unique ID and it defines the way it is displayed and used. It is always                recommended that the variable name should be in Pascal Case. It should be as descriptive as possible to make your automation easy to read by other developers and to save time.

Type: – It define the nature of the variable and what kind of data can be stored in the variable. In UiPath, the type is declared when the variable is created, however there are some types that can accommodate different types of data.

Default Value: – By using this option you can initialize your variable as per the variable type. Variable values can be changed throughout the process. For most variables, if no initial value is assigned when the variable is declared, there is default rule that assigns a value.

Scope: – By using this option, you can set the limit of the variable,as to which sequence or workflow the variable can be used. In some of the scenarios, there is no need for a variable out of the sequence, so we can only define the sequence name where we want to use that variable. It cannot exceed the workflow in which it was defined.

Different ways to Create Variables:

There are three main ways to create variables in UiPath:

From the Variable Panel: Navigate to the variables panel, Select the ‘Create Variable’ line and type in the name. Wherever needed, provide its name in the designer panel or in the desired properties field.

Different ways to create variables

From Expressions: Variable can be created from expression directly, in an activity input field or the Expression editor. Select a part of the expression and press Ctrl+K.

The set var field is displayed. Fill in the name and press enter. Check its type and scope in the Variable panel.

From expressions

From the Properties panel: In the property panel of any activity, select a field that can be edited, press Ctrl+K. The Set Var field is displayed. Fill the name and press enter. Check its type and scope in the variable panel.

From the properties panel

Invoke Workflow and Arguments

What is a Workflow?

A workflow represents a small piece of automation that you can re-use in your projects. Under a workflow you can design and work with all the UiPath studio activities and it defines the flow of your automation. There are different types of workflowavailable in UiPath as per the need of the projects. Below are the names of the workflows available in UiPath: –

  • Sequences
  • Flowcharts
  • State Machine
  • Global Exception Handler

The importance of different workflow is to breakdown your process into smaller bits which can be more reliable, faster, and very useful methods.

This allows the independent testing of components, enables team collaboration and component reuse. Hence, most of the automation projects require the use of multiple workflows that come together to provide a solid business automation solution.

What is an Argument?

Arguments are similar to a variable:

  • They can store the data dynamically
  • They have the same data types
  • They support the same methods and properties

The major difference between a variable and an argument is, they have additional property for the direction. Arguments can help to pass the data from one workflow to another. Arguments have specific directions: In, Out and In/Out. These directions tell the robot where the information stored in them is supposed to go.

IN: When the argument direction is “IN”, you are passing the values into the workflow. In other words, you can treat this as Input value of workflow.

OUT: When the argument direction is “OUT”, you are taking the values out from the workflow. In other words, you can treat this as an output of the process.

IN/OUT: When the argument direction is “IN/OUT”, you are passing the values into the workflow as an input and taking results from the workflow in the same argument.

Why are Arguments important?

Arguments are a key component when it comes to building more complex automation, where you need to store and use data between multiple workflows.

Different Ways to Create an Argument:

Argument names should be in PascalCase with a prefix stating the argument direction, such as in_DefaultTimeOut, in_FileName, out_TextResult, io_RetryNumber.

Different ways to create them are:

From the Argument Panel: Navigate to the argument panel, Select the ‘Create Argument’ line and type in the name. Wherever needed, provide its name in the designer panel or in the desired properties field.

From Expressions: Directly in an activity input field or the Expression Editor. Select a part of the expression and press Ctrl+M (for In arguments) or Ctrl+Shift+M ( for Out arguments). The Set Arg field is displayed.

Fill in the name and press enter. The argument is created. Check its direction and type in the Arguments created. In this way, the type is automatically received according to the activity.

From the Properties panel: In the properties panel of any activity, right click a field that can be edited, and select ‘Create In Argument’ or ‘Create Out Argument’ from the context menu. Alternatively, press Ctrl+M (In) or Ctrl+Shift+M(Out). The set Arg Field is displayed.

Fill in the name and press Enter. The argument is created and visible in the field. Check its direction and type in the Arguments panel. The arguments type is automatically generated depending on the selected property.

Leave a Reply

SOAIS - Worksoft Newsletter

To view on your browser, click here
Facebook Twitter LinkedIn
Dear Default Value,

Welcome to SOAIS Newsletter of September 2021!

Continuous Testing with Remote Execution
The speed of innovation continues to increase, driving rapid and relentless change for today’s ever-evolving IT landscapes, creating greater risk as IT and business teams scramble to ensure timely delivery. How can your organization keep pace? Test more, worry less. With Worksoft’s Connective Automation Platform, you can easily build and maintain automated tests, accelerating testing time without losing scope or volume. You can schedule and execute remote, continuous tests to intercept defects sooner and prioritize remediation - without sacrificing your nights and weekends. Explore how continuous test automation and remote execution can empower your organization.

Click here to connect with us to get more information on our services.

Skip Costly Rework with Dynamic Change Resiliency​

Change resiliency is imperative in ever-evolving IT environments. Our patented object action framework streamlines change management by assigning object definitions to your shared assets. The same object may be used in a thousand automation steps, but it can be easily updated by making one simple change to the model definition. The change automatically propagates to every single instance where that object may have been used without a single line of code or manual human involvement. For more change readiness you can also engage our Impact Analysis for SAP to predict how changes in SAP transports will affect your business processes. 

Please click here to watch the video to get a gist.

SOAIS Blog – Nuts and bolts of Certify Database Maintenance​

One of the key thing, which is often missed by the organizations, who have invested in using Worksoft Certify for automating their Business Process Validation initiatives, is implementing a Database Maintenance Plan. While the business and the test automation consultants get excited about the shiny new thing that they have got and start building the regression suite; planning and executing a database maintenance plan for most of the customers gets pushed down the priority list. However, since all the test assets in Certify are stored in a Database, a robust database maintenance plan is very important to maintain smooth operation of Certify with acceptable performance criteria. The customers usually start facing issues once they have built significant number of Certify processes which they have started executing on regular basis. Such executions add a lot of data to the tables storing results data and increase the overall size of the Certify database.

Please click here to read the complete blog.

Worksoft Blog – Process Intelligence: A Multi-Dimensional Approach

The ability to extract process knowledge has become easier through the years. Technology has evolved to the point where we can deploy capabilities that connect at multiple levels to extract different types of process insight. In the past, organizations were forced to spend enormous energy extracting data manually from different applications and databases. Then, they would have to use things like spreadsheets to transform the data and convert it into meaningful information. 

Please click here and read the complete blog.
Unit 9, Level 5, Navigator, ITPL,
Bangalore - 560 066.
Phone: +91 80 40071234
Suite 101, 1979, N Mill St,
Naperville, IL 60563
Phone 1-800-262-2427
Please click here to Unsubscribe / Unsubscribe Preferences

Leave us your info