Variables and Types in Robots

The Robot workflow can take input from a Basic Engine Robot and use the same variable types with some additions.

The variables used in Robots can be of different origin. New variables can be created from the context menu without interrupting your work and scrolling to the Variables section. Editing existing variables is possible without resetting the execution state of the Robot workflow. Input variables are edited in the Basic Engine Robot. Some of the output values can relate to variables created in the Robot.

  • To create a variable inside a Robot, use the Variables box in the Robot Attributes pane. Insert the name of the attribute and select its type from the drop-down list in the box. See Edit Robot for more information.

  • You can create variables of new types at any time, regardless of execution state of the Robot workflow. To do so, go to File > New Type. After that, new types and variables become available for use.

  • You can edit existing variables without resetting the execution state of the Robot workflow. To do so, right-click an action step and click Assign and Convert > Assign.

  • To make a value of a variable appear in the output, set its type in the Output box in the Attributes pane.

  • You can use both simple and complex variables and their attributes as input to the Robot workflow. Configure all the settings for the input variables in the Basic Engine Robot, and then add them to the Input box in the Attributes pane in the Robot. For more information, see Robot Input and Output.

  • You can use all of the complex variables from your Basic Engine Robot to create Record variables in the Robot workflow.

  • Local variables can be created and used only in Group Steps. If you want your step to use a local variable, include the step into a group with a local variable. See Configure Variables for more information about types of 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 a value of the password type variable in the Robot workflow.

Simple Variables and Types

The variety of simple variables in Robots differ from the ones used in Basic Engine Robots. See Type Attributes for Basic Engine Robots.

Robots can operate a limited number of variable types with set default values, which includes:

  • Binary: Empty
  • Boolean: false
  • Integer: 0
  • Number: 0.0
  • Password: Empty
  • Text: ""

Complex Variables and Types

Currently, Robots can process Simple type variables and Record type variables.

Record types are the same as complex types, the difference is that complex types are not delivered from the Basic Engine Robot to the Robot as is, but Record types basically derive from the complex types used in the Basic Engine Robot. Due to types having the same names in the Robot and the Basic Engine Robot, the variables can be operated easily without any errors.

You can use a complex variable and its attributes as input to the Robot workflow. See Robot Input and Output for more information.

Record Variables

Record variables are based on the record types (complex variables) that a Robot uses.

For example, a "Credentials" record type consists of two fields: a Username and a Password. If a user creates a variable of "Credentials" type (for example, "userCred"), the fields can be defined as follows: a Username is "Joe" and a Password is "Password". This information is represented in the State view. Then the value of the variable can be changed by assigning another value (for example, "Tom") to userCred.username in the Assign step. This changes the Username field to "Tom", while the Password field remains unchanged.

  • You can assign Record variables of the same record type to each other.

  • Record types can contain fields of type Date, Time, and DateTime. If you create a complex type of type Date, you can specify the corresponding field in the derived Record type to be either Date, Time, or DateTime (default).

  • You can assign attributes of Record variables to values with the same type or to another attributes or simple variables with the same type.

    All the shortcut menus in the Recorder view that use variables let you choose a field from Record type variables.

    For example, the Enter Text can get its value from fields of complex variables and if the type of the selected variable is not text, a conversion function is inserted to convert the value to text. Variables and fields of types that cannot be converted to text do not appear in the list.

    For the extract step you can also extract to fields of complex variables, but the type of the field must match the type of the extracted data, such as text or binary (for images). Only variables of the correct type appear on the menu.

    Custom default values set in a Basic Engine Robot are treated as test values. They are not transferred as default values to the Robot. To set a default value for a variable in a Robot, right-click an action step and click Assign and Convert > Assign.

Date, Time, and DateTime Record Field Types

Starting with Kofax RPA 11.3.0, Record types can contain fields of type Date, Time, and DateTime. 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.

Type Description
Date Date is a type that represents a date without a reference to a time or a time zone. A variable of type Date has the default value of 1601-01-01.
Time Time is a type that represents a time without a reference to a date and a time zone. A variable of type Time has the default value of 00:00:00.
DateTime DateTime is a type that represents a date and a time with a time zone in the ISO-8601 calendar system, which is essentially a Date and a Time value with a time zone. The default value for a DateTime variable is composed of the default types of its Date and Time components, with the default time zone corresponding to the location where the Robot runs.

To define a type that will contain a Date, Time, or DateTime record field type, you need to create a complex type with an attribute of type Date and define the record field type for that attribute. You can add as many Date attributes as required. This procedure shows how to create a complex type with three Date attributes, each having a different record field type.

  1. After you created a type, add an attribute of type Date. In the attribute configuration, ensure that Field Type in Record Type is set to Default. Default corresponds to the DateTime type.

  2. Add another attribute of type Date, set Field Type in Record Type to Use, and then set Type to Date.

  3. Add one more attribute of type Date, set Field Type in Record Type to Use, and then set Type to Time.



The result type contains three attributes of type Date, each having a different record field type.



In the Robot editor, the State pane will reflect the resulting Record type with the Date, Time, and DateTime values.

Note:

  • You can use the Date, Time, and DateTime types as variables in Robots. These types are designed specifically for use with Robots. Date and Time types contain a date and the time of day, respectively. DateTime contains both, a date and the time of day, as well as the time zone.

  • Date and Time types cannot be used as input variables in Robots.

  • DateTime can be used both as input and output variables in Robots. The Date type variable from a Basic Engine Robot can be passed as input to the DateTime input variable in the Robot, and the DateTime value can be returned as output to the simple type Date variable in the Basic Engine Robot. Similar to the simple type Date, the DateTime type contains a date and the time of day.