A Collection is a type of variable that contains a set of items. A Collection is always one of the following types:
- Simple Type Collection: Contains a list of values. Each value is of the same primitive data type (number, date, etc.)
- Object Type Collection: Contains a list of items that are each made up of a set of fields. For example, a Customer object would be made up of the fields First Name, Last Name, Account ID, Phone Number, Date Registered, and so on. Objects that are available for a Collection are defined in the Admin Console using Custom Types, Enums, Rules, or Intents.
Once you define a Collection, you can use it to display information to customers, allocate items from the Collection into other variables, and so on. Collections are almost always used to receive values from an outside service via an Integration Point. For more information about how to use Collections, refer to Collection Use Case Examples.
This article shows you how to create a Collection at the user level (available for use in the current Interaction). To create a Collection container at the system level (available globally for all Interactions), see Adding System Variables.
To define a Collection for the current Interaction:
- From the Solution Explorer or Variables list, click . The Variable Editor opens.
- In the Variable Name field, enter a unique name for your Collection variable.
- From the Variable Type drop-down list, select Collection.
- From the Of drop-down list, select the relevant option:
- For a simple Collection, select the required primitive type (text, number, etc.).
- For an object Collection, select the required Custom Type, Enum, Rule, or IA Intent (listed after primitive types in the dropdown list).
- Select Security options as needed. (Refer to Creating User Variables for more information.)
- Define a display Format as needed. (Refer to Designing Variable Display Formats for more information.)
- Click Save Variable when you have finished. The Variable Editor closes and the Collection is added to the Variables tab in the Solution Explorer.
Defining Default Values for a Collection
Optionally, you can provide one or more default values for the Collection variables in the current Interaction. This can be useful when Collection values need to be consistent or in conformance with Integration Points. Default values can be provided for Collections of both simple and object types.
- In the Default section, click and add a value in the field that appears, as shown in the following diagram:
To add additional values, click again.
You can enter static values as well as variables as defaults. To add a variable, enter '@' to view a list of available variables.
When entering or editing the default values, you can delete an entry by clicking its icon or change the order of entries by dragging its icon as needed.
- Click Update Variable when you have finished. The Variable Editor closes and the Collection is added to the Variables tab in the Solution Explorer.