Read and Review Automation Anywhere Documentation

Automation Anywhere Version 11.3

Close Contents

Contents

Open Contents

Array Type Variables

  • Updated: 5/06/2020
    • 11.3.x
    • Explore
    • Enterprise

Array Type Variables

An array variable is a two-dimensional variable that holds multiple values in a table of rows and columns. Arrays are very powerful for creating staging areas for data that need to be retrieved by your process as it runs.

When/Why To Use an Array Type Variable

Common uses of array variables include:

  • Extracting data from web pages
  • Extracting many rows of data from an Excel spreadsheet or a database
  • Read or write data from/to a legacy system, an ERP system, or another application
  • Filling out order forms with different fields from Excel to Database

The values can represent either text or numeric data.

After you create the variable, you can use it by inserting the variable in several of the Workbench commands.

When the value of the variable is modified, this value is reflected in any subsequent commands that are run by the task.

How to Create an Array Type Variable

You can create an array type variable in four ways:

Direct Assignment

Create an array type variable using direct assignment when you want the values of the variable to be defined directly to the variable.

To create an array type variable using direct assignment, follow these steps:

  1. In the Workbench, click the Variable Manager tab on the right side.
  2. Click the Add button. The 'Add Variable' window is displayed, with the 'Create New Variable' option selected.
  3. Select type 'Array'.
  4. Enter a name for the variable. The name must begin with an alphabet and should not contain spaces.
  5. Select how you want the array to be created. Default selection is 'Value' which indicates that you will define the values of this variable directly in it.
  6. Specify the number of rows and columns in the field provided. Default values are 1 X 1.

  7. Click the Initialize Values button. The Array Value Details window is displayed based on the rows and columns provided in step 6.

  8. Enter the values for each cell.
  9. Click the Save button to save the values.
  10. Click the Save button again to save the array variable.

You can modify the array dimensions using the Add Row, Add Column, Delete Row, and Delete Column buttons.

After the variable is saved, it is displayed in the Local Variables section of the Variable Manager.

Text File Assignment

Create an array type variable using text file assignment when you want to read values from a specified text file into the array variable while the task is running. The text file is used to define the array variable.

To create an array type variable using text file assignment, follow these steps:

  1. Determine the text file that you will use for assigning values.
    • For Rows enter the data in a new line.
    • For Columns use comma separated values.
    • Example: sports_team.txt

  2. In the Workbench, click the Variable Manager tab on the right side.
  3. Click the Add button. The 'Add Variable' window is displayed, with the 'Create New Variable' option selected.
  4. Select type 'Array'.
  5. Enter a name for the variable. The name must begin with an alphabet character and should not contain spaces.
  6. Select 'Read from text file' from the dropdown.
  7. In the Select File field, browse to the file or type the file path for the required text file. Use the Open File button to view the selected text file or to modify it.
  8. Click Save.

After the variable is saved, it is displayed in the Local Variables section of the Variable Manager.

Excel or CSV File Assignment

The Automation Anywhere Web Recorder and Excel commands extract data to Excel and CSV formats. You can use these files to create an array variable that might be used for entering or manipulating data for computing or analysis.

Automation Anywhere provides a range of options for retrieving subsets or partial sections of the data.

Create an array type variable using an Excel or CSV file assignment when you want the values of the variable to be retrieved from an Excel or CSV file.

To create an array type variable using Excel or CSV file assignment, follow these steps:

  1. In the Workbench, click the Variable Manager tab on the right side.
  2. Click the Add button. The 'Add Variable' window is displayed, with the 'Create New Variable' option selected.
  3. Select type 'Array'.
  4. Enter a name for the variable. The name must begin with an alphabet and should not contain spaces.
  5. Select 'Read from Excel/CSV file'from the dropdown.
  6. Browse and select the required file.
  7. Select the options you want for reading values from specific locations in the file. You can choose from:
    • All cells
    • Entire Row
    • Entire Column
    • Range
    Note: If you select Range, specify the From and To. You can use the Open File button to view the selected text file or to modify it.
  8. Click Save.

After the variable is saved, it is displayed in the Local Variables section of the Variable Manager.

Database Assignment

You can define an array variable with values derived from the result of a database query. The array variable is created with dimensions that are determined as a result of running the query.

To create an array type variable using a database query, follow these steps:

  1. In the Workbench, click the Variable Manager tab on the right side.
  2. Click the Add button. The 'Add Variable' window is displayed, with the 'Create New Variable' option selected.
  3. Select type 'Array'.
  4. Enter a name for the variable. The name must begin with an alphabet and should not contain spaces.
  5. Select the 'Read from database' from the dropdown.
  6. Specify the database connection string details using Browse.Clicking on browse opens the Data Link properties dialogue box. Use it to test and create a valid connection string for the database of your choice.
  7. Enter Select Query by typing the entire database query.
  8. Click Save.

After the variable is saved, it is displayed in the Local Variables section of the Variable Manager.

Once you have created array variables by reading data from various sources, use Loop command to easily process them in your automation task.Array variable with Loop command.

Send Feedback