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

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.