List Variables
The List variable can be used to store groups of Boolean, String, or Numeric data types within a Ruleset.
- Selectively extract values for use in rules in the Ruleset.
- Called as a looping construct in a Composite Rule.
In conjunction with this variable type, several new List-related Actions are available in the new engine. These are part of the Collection group of Actions.
Action | Description |
---|---|
CreateList | This Action returns a new empty list of the defined variable type, and is used with these Actions below. |
ListAdd | Adds an element to the specified list. Inputs are:
|
ListSize | Returns the number of elements in a specified list. This
has one input:
|
ListGet | Returns an element from a list at a specified position.
Inputs are:
|
CreateRange | Returns a read-only list of numbers; starting and stopping at
user-defined values. This list can then be used to create a looping construct in
conjunction with a Composite Rule. Inputs are:
|
Creating a List Variable
- Click Add Variable.
- Type the name you wish to give the variable.
- Select List from the Type drop-down.
- Select the Element Type. Choices are Boolean, String, and Number.
- Click OK to complete this task.
Result: The new variable now appears as an option in the Variables pane.
Example
This simple example shows how you might use several of the Collection Actions with the List variable type.
The first Rule uses the CreateList Action, which uses the List-type variable that we already created – ListField.
The next Rule - a For Each Composite Rule - shows that it contains five child rules. All but one are Move rules; the second Rule down is another Collection Rule – ListAdd, which in this case will add an element (“Field 2”) to the “ListField” list.
Another Composite Rule (For each ListField….) creates a new record for each element in the List. In this case we only have one element, “Field 2”. The output below shows how these rules could execute.
While this example may be simple, it demonstrates the two use cases noted above.