List package

The List package contains actions that enable you to perform various operations on a variable of the list data type.

Working with variables of list data type

A list is a collection of ordered values. The values can be of Boolean, number, or string data subtype. When initializing a list variable, you can select the Any data subtype in order to hold any of the three data subtypes. You can manually enter values by creating a new variable or selecting an existing one from the Variables menu, and then clicking Add.

Common uses of list variables include:
  • Sending an email to multiple recipients.
  • Searching multiple web addresses.
Note:
  • Sorting of list values is currently not supported.
  • You cannot directly assign values from the record to a list. However, you can use Loop action to loop through all the record items and then add them to the list variable.

Actions in the List package

If you are using a List action in a Loop action, you must use the For each item in the list iterator.

The following actions are available in the List package:

Action Description
Add item See Add item action in List.
Append See Append action in List.
Assign See Assign action in List.
Clear See Clear action in List.
Get item See Get item action in List.
Join items See Join items action in List.
Remove item See Remove item action in List.
Set item See Set item action in List.
Size See Size action in List.

Example

Create a bot to add items to a list and retrieve data from a list. To achieve this functionality, perform the following steps:
  1. Create a bot.
    1. On the left panel, click Automation.

      A list of available bots and forms is displayed.

    2. Click Create a bot.
    3. Enter the bot name: ListBot
    4. Click Create and Edit.
  2. Create the following variables.
    • Variable: StringList
      • Type: List
      • Subtype: String
      • Name: StringList
      • Default value at 0: Automation
      • Default value at 1: Anywhere
    • Variable: SampleString
      • Name: SampleString
      • Default value: PvtLtd
    • Variable: ListOutput
      • Type: Any
      • Name : ListOutput
  3. To insert an item into a list variable, from the Actions pane, double-click or drag the List > Add item action.
    1. In the List variable field, select StringList.
    2. In the Items to be added field, select SampleString.
    3. To insert the item at the end of the list, select the To end of list option.
  4. To retrieve a value at a specified position in a list, from the Actions pane, double-click or drag the List > Get item action.
    1. In the List variable field, select StringList.
    2. In the Index number field, enter 0. This is to specify the position in the list from where you want to retrieve a value.
    3. To store the output from Assign the output to variable list, select ListOutput.
  5. To print the value of the Index 0, double-click or drag the Message box action. Click Save and Run.

    The bot displays the zero index data of the list variable, which is Automation.