Variables

Within Robots, use the Variables area of the Robot definition pane to define variables. See Edit Robot for navigation and context-menu options.

Add a variable

  1. If the Variables area is not expanded, click the down arrow, which changes to an up arrow.

  2. If no definitions exist, click the Add Variable button or right-click the context menu to select Add Variable.

  3. If definitions exist, use one of the following methods:

    • To add after existing entries, click the green plus sign.

    • To add between existing entries, select the preceding variable, then select Add Below to insert the new one.

    • To add at the top of an existing list, place the pointer at the top and select the Add Variable option from the context menu.

  4. From the drop-down list, select the input Type.

  5. Name the variable and press Enter.

Delete a variable

Use the Variables area in the Robot definition pane to delete definitions. See Edit Robot for navigation and context-menu options.

In the Variables area, right-click the variable and click Delete.

Variables in Robots

The variables in Robots differ from those used in Basic Engine Robots. Robot variables have either simple types or record types.

  • Assign variables to values of the same type as the variable.

  • Assign fields of record variables to values of the same type.

From the shortcut menus in the Recorder View that use variables, you can also choose a field from record type variables.

Simple type variables with default values

All types have a default value, even Record types. The default value for a Record type is one where all the fields have the default value for their type.

Variables have a default value that depends on the variables type. Default values for simple type variables include:

  • Binary: Empty
  • Boolean: False
  • Integer: 0
  • Number: 0.0
  • Password: Empty
  • Text: ""
  • Date: 1601-01-01

  • Time: 00:00:00

  • DateTime: Default value is composed of the default types of its Date and Time values, with the default time zone corresponding to the location where the Robot runs. (See Handle Date and Time with Robots and Extract DateTime.)

Custom default values set in a Basic Engine Robot are treated as test values. They are not transferred as default values to a Robot.

To set a different initial value than the default value, right-click a flow point in the Robot and click Assign and Convert > Assign.

Record type variables with Date, Time, and DateTime

For Record types that contain fields of type Date, Time, and DateTime, when you create a type in the type editor, you can specify for an attribute of simple type Date what the type should be for the corresponding field in the derived Record types.

To define a type that contains a Date, Time, or DateTime record field type, create a variable with an attribute of type Date, then define the record field type for that attribute.

Type Description
Date Date is a type that represents a date without a reference to a time or a time zone.
Time Time is a type that represents a time without a reference to a date and a time zone.
DateTime DateTime is a type that represents a date and a time with a time zone in the ISO-8601 calendar system.

These types correspond to the Date type of Basic Engine Robots and are designed to be used exclusively in Robots to handle date and time.

  • Date and Time types contain a date and the time of day, respectively.

  • The DateTime contains both a date and the time of day and the time zone.

  • If a simple Date variable is passed from a Basic Engine Robot to an input parameter of type Date in a Robot, only the date part of the input value is passed.

    If an input parameter is of type Time, only the time part of the input value is passed.

  • The DateTime can be used both as input and output parameters in Robots.

    • The Date type variable from a Basic Engine Robot can be passed as input to the DateTime input variable in the Robot.

    • The DateTime value can be returned as output to the simple type Date variable in the Basic Engine Robot.

Tips for using and editing variables between robots

The Robot workflow can take input from a Basic Engine Robot and use the same variable types, with some additions. To configure variables within Basic Engine Robots, use the Variables tab. See Configure variables.

The variables used in robots can be of different origins. Create new Robot variables from the Variables area of the Robot definition pane without interrupting your work (to navigate to the Basic Engine Robot Variables tab).

  • Create a new type while you are editing a robot, and use it for a new variable in your robot without interfering with the execution state of the robot. To do this, create a new type in the type editor. After that, the new type becomes available, and you can add a new variable with the type.

  • Create local variables and use them in Group Steps. If you want your step to use a local variable, include the step in a group with a local variable. See Configure variables.
  • Password type variables in a Robot can transfer their value from and to a password type variable created in a Basic Engine Robot. You cannot manually assign the value of the password type variable in the Robot workflow.

  • Record types may be derived from complex type variables.