Collections

Important Points

The list of items below are importart in understanding details concerning collections.

  • ARRAY, SET, and LIST are the only parameters that DIFFERENCE, UNION, and INTERSECTION function may take.
  • The DIFFERENCE, UNION, and INTERSECTION functions must take two or more parameters.
  • If there is a mix of set and list parameters, all lists are converted to sets, duplicates removed.

Definitions

  • ARRAY: This is an extension used to convert a flag enum field to a set of values

  • COUNT: This is an extension used to count the number of items in the result set.

  • LIST: A list can contain duplicate items. All items within a list must be of the same type.

  • SET: All item in a set must be unique. All items within the set must be of the same type.

  • DIFFERENCE: Returns the set that is items that are only in one set within the parameter sets provided.

  • UNION: Returns the combined set of items of all parameter sets.

  • INTERSECTION: Returns the set that is items that are in 'every' parameter set provided.

  • NOTE: In the CRMLS rules. although supportted, LIST is not used.

Collection Functions

Function Expression Result Comment
ARRAY ARRAY(Appliances) SET('FZ,'GD') Converts flag enum field to an array
COUNT COUNT(ARRAY(Appliances)) 2 Counts the items in the array provided
LIST LIST(1, 2, 2, 3) LIST(1, 2, 2, 3) Duplicate items are preserved.
SET SET(1, 2, 2, 3) SET(1, 2, 3) Duplicate items are removed.
DIFFERENCE DIFFERENCE(LIST(), LIST()) LIST() Collection operators require two or more LIST() or SET() arguments.
UNION UNION(LIST(1, 2), SET(3)) SET(1, 2, 3) Arguments of type LIST() are converted to SET().
INTERSECTION INTERSECTION((LIST(1, 2, 3), LIST(2, 3))) SET(2, 3) Since the return type of collection operators is SET(), they can be composed.