Rules & Multi-Valued List Fields

Rule that access multi-valued list fields have a number of specific points that you should understand. The examples in this section all assume you have a multi-valued list field with a name of FRUITS, and that valid values within the list are apple, pear, orange, banana and raspberry.

Setting Values in a Multi-Valued List Field

For each assignment you make of a value within a multi-valued field, you are selecting that value. For example, if you want to set both apple and orange you would use:

FRUITS = ['apple','orange'];

If you want to set a single value of pear within the list you use a simple assignment statement.

FRUITS = 'pear';
 
Note that when you assign one or more values to a multi-valued field with an assignment, you are adding to the existing list values.  For example, if the list contains both apple and orange and you execute this:
 
FRUITS = ['orange', 'raspberry'];
 
the list will then contain apple, orange and raspberry.
 

Clearing All Vallues from a Multi-Valued List Field

Simply set the the list as follows:
 
FRUITS = '';

Checking Values Exist within a List

This syntax will find whether the single value of orange is currently set within the multi-valued list:

if (FRUITS.{contains 'orange'}) { ... };

This syntax will find whether the values of pear, orange and banana are currently set within the multi-valued list:

if (FRUITS.{contains 'pear', 'orange', 'banana'}) { ... };

This syntax will find whether the values of pear, and orange are currently set within the multi-valued list, but the value of banana is not within the multi-valued list:

if (FRUITS.{contains 'pear', 'orange'} && FRUITS.{excludes 'banana'}) { ... };