Read and Review Automation Anywhere Documentation

Automation 360

Close Contents


Open Contents

Create a variable

  • Updated: 2022/09/13
    • Automation 360 v.x
    • Build
    • RPA Workspace

Create a variable

Create a variable to store values.

When you create a variable that uses characters such as the underscore (_) or hyphen (-) in your variable name, note that the underscore or hyphen are treated as the same character for the variable names. For example, global-temp_path is treated the same as global_temp-path. If you create a new variable that uses variables different from these two characters, an error is displayed.

If you have created a global variable as global-temp-path, you can refer to this variable in any of the following formats:
  • global-temp-path
  • Global-Temp-Path
  • global_temp_path
  • Global_Temp_Path


To create and configure a variable, perform the following steps:

  1. From the Bot editor, click Variables > Create variable (+ icon) at the top of the Variables menu.

    variable menu screenshot

  2. In the Create variable window, enter a descriptive name for the variable that is prefixed by a lowercase letter to indicate the variable type.
    For example, sCellValue to indicate a string data type.
    • You can use double-byte characters, such as Chinese, Japanese, or Korean characters, in a variable name. Unicode range supported in variables
    • Variables cannot be named Java keywords, such as String, Boolean, Integer, Public, and Finally.
  3. Optional: Enter a description.
    Recommendation: Provide meaningful variable description when defining input or output variables.
  4. Optional: Select the Constant (read-only) option to ensure values cannot be edited or overwritten.
  5. Select from the following options:
    This field pertains to using a bot to run other bots. See Task Bot package.
    • Use as input: The variable holds a value that can be passed from the parent bot to a child bot. (Applicable only to a child bot)
    • Use as output: The variable holds a value that can be passed from a child bot to the parent bot. (Applicable only to a child bot)
    • Both: The value can be passed in both directions.
    • Neither: The variable is confined to this bot; it cannot be shared across other bots.
    The following example illustrates when to select Use as input or Use as output in a variable.

    Suppose you want to add two numbers. The values are present in the parent bot, and the child bot performs the calculations. For the parent bot to transfer the values to the child bot, the two variables you created must be selected as Use as input so that the child bot can receive the values. Now, for the parent bot to receive the calculated value, the variable that stores the result of the calculation in the child bot has to be selected as Use as output.

    Note: Ensure that you select the check boxes when you create a variable in the parent bot and the child bot. When you build the bot, and if you edit the selection of check boxes, it might impact your parent bot references, such as your parent bot might not work after this change.
  6. Select a data type from the drop-down list.
    For more information on data types, see Variable types.
  7. Optional: Enter a default value to assign to the variable.
    The values are NULL/empty by default.
  8. Click Create.
    The variable appears in the Variables pane on the left side of the Bot editor.
    If you want to edit a variable, you can change its name and value but not its data type.
  9. To insert a variable into an action field, perform one of the following actions:
    • Click F2 to open the variables list.
    • Click the Insert a value icon, located on the right side of the field.
    • Enter the variable name. As you type, the field generates suggestions of existing variables.
      Note: Add a dollar sign at the start and end of the variable. For example, $myVariableName$.
    You can use the variable option and pass it as a parameter to open a file in packages such as XML, Excel basic, or Excel advanced. To open files with different extensions, use the variable option to assign the folder path, file name, and file extension . First, create a variable for the folder path, $sFolder$. Then, for the files in the folder path, create two variables, one for file name $name$ and another for file extension $extension$. To open a file, combine the variables as a string, such as $sFolder$\$name$.$extension$. For the extension to work with different file types and different open options, you can add conditional logic.

Next steps

Build a Go be Great bot: Follow the steps in this procedure for an example of how to create a variable and assign it to an action.
Send Feedback