Adding, Editing and Deleting Variables
- Updated: 2020/05/08
Adding, Editing and Deleting Variables
Variables are storage locations for known or unknown information. When creating Logic, variables play an important role in maintaining or calculating information. Variables can help you in a number of ways, from fetching online data to transferring data between applications.
Automation Anywhere allows you to use various types of variables - locally defined or system defined in a MetaBot Logic. The following section describes how to add, edit and delete locally created variables.
Adding Variables to a MetaBot Logic
You can use the F2 function key to list all user and system variables that are available for insertion in a MetaBot Logic.
User defined variable types
You can create four types of variables that can be used in a MetaBot Logic - Value, List, Array, and Random.
Value - You can use a value type variable when you need to hold a single data point and use it in multiple places. This "placeholder" value can represent either text or numeric data.
After you create the variable, you can use it by inserting the variable in several of the Logic Editor commands. When the value of the variable is modified, this value is reflected in any subsequent commands.
You can also mark a value type variable as 'Regular Expression' . These, you can use when creating Task Bots /MetaBot Logics that require pattern based searches in files, folders and window title commands.
List - You can use a list type variable when you need to retrieve multiple values, one by one. It is basically one dimensional placeholder for data.
Common uses of list variables include:
- Sending email to multiple recipients
- Passing different values inside of a loop
- Searching multiple web addresses
The values can represent either text or numeric data.
Array - Use an Array type variable for creating staging areas for data that need to be retrieved by your process as it runs. It is a two-dimensional variable that holds multiple values in a table of rows and columns.
Random - You can create two types of random variables: string and numerical. Random variables are useful when you need to generate a random, repetitive string or numerical set. The values are generated when you run the Task Bot / MetaBot Logic.
Common uses of Random variables include:
- String: Generating test data as input for fields or forms
- Numerical: Generating ID numbers in batch
Password - Use a password type variable when you specifically need to hold the data as a "Password". This value is encrypted by default.Note: The password variable type is deprecated from Automation Anywhere version 11.0. You shall not be able to create new password type variables. However, MetaBot Logic(s) that make use of such variables shall continue to run. You would not be able to update such Logic(s) without replacing password type variables with more secure Credential Vault variable(s).
Since MetaBot Logics can be used in Task Bots, you might want to pass on certain parameters to another Task Bot / Logic (of the same MetaBot) when executing a bot. For this, you can use variables and define their parameter types. Defining the type of parameters ensures optimum use of variables across bots.
In MetaBot Logic, you can define four types of parameters - None, Input, Output, and InputOutput.
Refer Variables - Parameter Types for details.
Adding or Editing a Variable
You can add or edit and modify any local variable that you have created. In addition, you can edit the pre-defined variables.
To add or edit a variable, follow these steps:
- To edit an existing variable:
- Click Select Variable from List.
- Click the Edit button or right-click on the variable and select Edit. The Edit Variable window is displayed.
- To create a new variable, click Create New Variable. The Add Variable window is displayed.
- Modify the variable fields as necessary. Options include selecting or entering data for: the Variable Type, Parameter Type, Name, Regular Expression option, Select type of content, Log For Analytics option, selected Value content, Description or the method of determining value.
- Click Save.
Adding or Editing Description
You can add and edit description to the Value, Array, and List type variables when the Parameter Type is Input, Output, and InputOutput. This is highly useful as it provides contextualized help without any clicks, while using MetaBot Utilities/Logics in Task Bots.
Deleting a Variable
To delete a variable, use the Variable Manager.
For instance if you 'Copy All' variables to another Logic, you might need to delete several variables that are redundant in the new navigational flow.
To delete a variable,
- Select the variable you want to delete.
- Click the Delete button or right-click on the variable and select Delete.
- When the confirmation message is displayed, click Yes.