List Variables

The List variable can be used to store groups of Boolean, String, or Numeric data types within a Ruleset.

This can be used to accomplish different use cases:
  • 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:
  • list: The list that is being added to.
  • element: The element that is being added to the list.
ListSize Returns the number of elements in a specified list. This has one input:
  • list: The list being measured.
ListGet Returns an element from a list at a specified position. Inputs are:
  • list: The list that being inspected.
  • index: The position of the element to be listed. The position index starts at 1.
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:
  • rangeStart: The starting position of the range.
  • rangeEnd: The ending position of the range.
  • rangeStep: The interval at which looping occurs within the range. For example, in a range list of 10, a rangeStep of "2" would result in 5 loops.

Creating a List Variable

These steps take place in the Ruleset editor's Variables section.
  1. Click Add Variable.
  2. Type the name you wish to give the variable.
  3. Select List from the Type drop-down.
  4. Select the Element Type. Choices are Boolean, String, and Number.
  5. 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.