Your variables (user-defined)

Users and some actions create user-defined variables to temporarily hold values. Use this kind of variable to input values into an action (window title, login credential, or file path) or to accept the output of an action (values read from a file or a Boolean return).

When you are building automated tasks, some actions need to refer to and use some values, and these values can be stored in variables. Variables can help you in several ways, from retrieving online data to transferring data between applications, such as Microsoft Excel. A variable can hold one or more values. The values that a variable can contain and the operations that can be performed on the variable are determined by its data type.
Note:
  • A bot can return only a maximum of 3 MB to an output variable. In addition, the table structure in BotOutputVariable is limited to 300,000 cells.

    If you insert more than 300,000 cells, an error message is displayed indicating that the debug variable is too big to debug or that BotOutputVariable is too big to process.

    Workaround: Store the bot output on the device, such as in a .txt file. If the output must be shared across multiple Bot Runners, store the output in a shared drive.

  • The size of bot input variables is limited to 1900000 bytes. We recommend you use .txt file to store large data set.

Variable types

The data type of a variable is an attribute that determines the kind of data that the value stored in the variable can have. Data types include storage classifications, such as integers, strings, and characters. Variables such as dictionary, record, list, or table can hold multiple data types.

Most variable types have a package with a similar name, which contains actions used to perform operations on the values stored in the variable. For example, use the actions in the String package to work on String variables. Similarly, to work on Number variables, use the actions in the Number package. To convert the value of one variable type to another, see Type conversion

You can also reuse identical values between bots instead of creating new variables for each bot. See Global values.

Variable naming

A variable name can contain a maximum of 50 Unicode characters, including numbers (0-9), Latin letters (A-Z, a-z), and special characters (- and _). You can use double-byte characters, such as Chinese, Japanese, or Korean characters, in a variable name. Unicode range supported in variables

We recommend using camel case for variable names and prefixing the variable name to indicate the scope and data type. For example, iFileEmailAttachment for a file type variable that is used to provide an input.
Note: The following is a recommended naming standard for variables <type/scope indicator><data type><Variable name>. While there are many naming convention options, some standards must be adopted and used consistently within the organization.

The <type/scope indicator> is a single character as follows:

  • p = local variable (neither input nor output)
  • i = input variable
  • o = output variable
  • io = input and output variable
  • c = constant
Following are a few more examples for naming variables.
  • iStrAuditLogPath: a string type variable received from a calling task
  • oNumReturnValue : a number type variable returned to a calling task
  • ioStrStatus: a string that is both received from and returned to a calling task
  • cStrNull: a string that holds no value; for example, useful for string comparisons to check whether a value is present

For more information about scope, see Task Bot package. This standard enables you to search for variables by type. For example, oStr returns variables that are used to hold output string values.

Variable types

Variable type and suggested name Description Use examples
Any

Any

Stores Boolean, Data table, Datetime, File, Number, Record, String, or Window data types. Use this variable type when you are uncertain of which data type an action will output. Example of using the Run action
Boolean

Bool

Stores either a True or False value.
Credential

Cred

Stores string values securely, preventing values from being displayed in a message box or written to a file. The value is either selected from the Credential Vault or is user-provided.

Credentials and credential variables in the Bot editor

DateTime

Date

Stores a value containing a single date and time value. You can format the values by selecting a predefined format or specifying a custom format.

Datetime formats

Dictionary

Dict

Stores data in the form of key-value pairs. The value can be boolean, number, or string.

Dictionary package

File

File

Stores a file path.

Example of using a file variable

Form

Form

Stores the value that was input into an interactive form field.

Interactive forms

List

List

Stores a sequence of boolean, number, or string values.

List package

Number

Num

Stores numeric values, including integers and decimals. It holds values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, and up to 15 decimal digits.

You can assign a randomly generated value to this variable.

Random number action

You can remove the digits following a decimal when converting the value into a string.

Number to string action

Record

Rec

Stores a single row of values extracted from a table. The values can be boolean, datetime, number, or string.

Record variable

Example of entering data into a web form from a spreadsheet
Session

Sess

Stores the session name from the Excel basic, Excel advanced, or Terminal Emulator packages. Pass this variable from a parent to a child bot in the Task bot > Run action to enable the child bot to process the data in the file opened in the parent bot.
Note: When initializing this variable in the child bot, select Use as input.
Example for sharing an Excel session between bots
String

Str

Stores alphanumeric and special characters, and empty values. It can hold up to 65535 UTF-8 characters. A string variable can hold multiple lines of text. You can compare the value in a String variable to an empty String variable.

Example of using a conditional statement

Table

Table

Stores multiple values in a table of rows and columns. The values can be boolean, datetime, number, or string. Assign values to a table variable by extracting values from a CSV/TXT file, Excel file, or a Web form.
Window

Win

Stores a window title and URL.

When you create a Window type variable, note that selecting Browser as default value supports only Google Chrome tabs whereas selecting Application as default value supports any application window.

Some actions, such as the Capture action, create a Window variable to store the specified window title and URL.

Example of extracting data from a web table

How window variables behave

When you use the Recorder to automate a specific window, for example window 1 and perform a Click action on the window, and run the bot, the bot for the first time searches that specific window and assigns a window handle to it for identification and saves it in cache. When you perform a second Click action on the same window 1, the bot verifies if the window 1 is available. If the window 1 is available, then the bot no longer must search for the specific window as the window is already stored in cache and automatically fetches it from there. This enhances the performance of the bot and saves time as the bot does not have to search the window at every instance if the window is already available.

Suppose you now perform a third Click action on the same window 1 that opens to another page because of which the window title has now changed. For example, you open a Yahoo India web page and perform a Click action on the News option on the web page, the action navigates you to another page which changes the title of the window.

Hence in this case when you run the bot, the bot still fetches the same window that is stored in the cache and performs action on it because the window is still the same but only the title has changed. Hence this behaviour provides a good user experience, and you can avoid creating multiple window variables for each window whose title changes while automating web pages.

Delete variables

You can delete user-created variables in either of the following ways:
  • Delete one variable: In the Variables palette, click the vertical ellipsis to the right of the variable name and click Delete variable.
  • Delete unused variables: In the Variables palette, click Delete unused variables, select which variables to delete, and click Delete.