This article provides a comprehensive guide on using all the list functions available in Decision Model and Notation (DMN). These functions are essential for modelling business decisions using DMN.
DMN List Functions Reference
| Function | Parameters | Example | Result | Purpose |
|---|---|---|---|---|
| all (list) | list (array): list of Boolean items or an argument list of one or more Boolean items (Mandatory) | all(true, false, true, true) | false | Returns false if any item is false, else true if empty or all items are true, else null. |
| any (list) | list (array): list of Boolean items or an argument list of one or more Boolean items (Mandatory) | all(null, true, 0, false) | true | Returns true if any item is true, else false if empty or all items are false, else null. |
| append (list, item) | list (array): list of elements including null (Mandatory) item (any element including null): item or items to be appended to list (Mandatory) | append([1, 2], 3) | [1, 2, 3] | Returns a new list with items appended. |
| concatenate (list) | list (any elements including null): list of elements to be concatenated (Mandatory) | concatenate([1, 2, 3], [4, 5, 6],[7, 8]) | [1, 2, 3, 4, 5, 6, 7, 8] | Returns new list that is a concatenation of the arguments. |
| count (list) | list (array): given list to return the size count from (Mandatory) | count(1, 2, 3) | 3 | Returns the size of a list– if the list is empty zero is returned. |
| distinct values (list) | list (array): given list to return distinct values from (Mandatory) | distinct values(1, 2, 3, 2, 1) | [1, 2, 3] | Removes duplicates from a list. |
| flatten (list) | list (array): non-empty list of numbers or argument list of numbers (Mandatory) | flatten([[1 ,2],[[3]], 4]) | [1, 2, 3, 4] | Returns a flattened non-nested list from the given list. |
| insert before (list,position,newItem) | List (array): list of elements including null (Mandatory) Position (non-zero integer): represents a position within range of the list (1 is the first position in the list and -1 is the last) (Mandatory) newItem (any element including null): item to be inserted at the given position | insert before([1, 2, 3], -1, “new”) | [1, 2, “new”, 3] | Returns a new list with new Item inserted into position. |
| list contains (list, element) | list (array): list of elements including null (Mandatory) element (any element including null): element to check (Mandatory) | list contains([“Viewer”, “Commenter”, “Editor”, “Uploader”], “Editor”) | true | Returns true if the list contains the given element, otherwise returns false. |
| list replace ( list, position, newItem) | list (array): list of elements including null (Mandatory) position: position index(Mandatory) newItem: any element including null(Mandatory) | list replace([“James”,”Daniel”,”Jone”],-1,”Karl”) | [“James”,”Daniel”,”Karl”] | Return a new list with new Item replaced at specified position. |
| mean (list) | list (array): non-empty list of numbers or argument list of one or more numbers (Mandatory) | mean([-1, 0, 1]) | 0 | Returns arithmetic mean (average) of given numbers. |
| product (list) | list (array): list of 0 or more numbers or an argument list of one or more numbers (Mandatory) | product(1,2) | 2 | Returns product of given numbers or null if list is empty |
| sublist (list, start position, length) | list (array): a list to return the sublist from (Mandatory) start position (non-zero integer): position to start from in the list (1 is the first position of the list and -1 is the last position) (Mandatory) length (non-negative integer): length from the starting position to return (1 returns 1 value and 0 will return an empty list) (Optional) | sublist([1, 2, 3, 4, 5], -2, 1) | [4] | Returns a list based on given starting position and length for the provided list. |
| sum (list) | list (array): list of 0 or more numbers or an argument list of one or more numbers (Mandatory) | sum(4, 5, 6) | 15 | Returns sum of given numbers or null if list is empty |
| remove (list) | Removes item at given position in a List (array): list of elements including null (Mandatory) Position (non-zero integer): represents a position within range of the list (1 is the first position in the list and -1 is the last) (Mandatory) | remove([1, 2, 3], -1) | [1, 2] | Removes item at given position in a list. |
| reverse (list) | list (array): list of elements including null (Mandatory) | reverse([1, 2, 3]) | [3,2,1] | Reverses the given list. |
| stddev (list) | list (array): non-empty list of numbers or argument list of numbers (Mandatory) | stddev([1, 3, 5, 7, 9]) | 3.1622776601683795 | Returns the sample standard deviation of the list of numbers. |
| mode (list) | list (array): non-empty list of numbers or argument list of numbers (Mandatory) | mode( 6, 3, 9, 6, 6 ) | [6] | Returns the mode of the list of numbers. If the result contains multiple elements, they are returned in ascending order. |
| union (list) | list (array): non-empty argument list or lists. Must be as an array. (Mandatory) | union([1,2],[2,3]) | [1, 2, 3] | Returns the union (concatenate with duplicate removal) of given lists. |
| index of (list, element) | list (array): non-empty list of numbers or argument list of numbers (Mandatory) element(number): a number to lookup index (Mandatory) | index of([1, 2, 3, 4], 3) | [3] | Return ascending list of list positions containing match. |
| median (list) | list (array): list (array): non-empty list of numbers or argument list of numbers (Mandatory) | median( 8, 2, 5, 3, 4 ) | 4 | Returns the median element of the list of numbers. |
| min (list) | list (array): non-empty list of numbers or argument list of numbers (Mandatory) | min([1,2,3]) | 1 | Returns the minimum item. |
| max (list) | list (array): non-empty list of numbers or argument list of numbers (Mandatory) | max(1,2,3) | 3 | Returns the maximum item. |

