You are viewing the documentation for Blueriq 14. Documentation for other versions is available in our documentation directory.
UNIQUE
Filters duplicate items from a collection resulting from a subexpression in a larger expression. An expression resulting in a collection never contains duplicate values. A subexpression with the COLLECT
statement however, can contain duplicates. See the note on collections and duplicates for more info.
Syntax
UNIQUE ( collection )
Input
- collection - A collection of attribute or entity instances.
Return type
- collection
Examples
Suppose the following model.
Person instance | Person.name |
---|---|
Person_1 | “Kim” |
Person_2 | “Rick” |
Person_3 | “Bob” |
Person_4 | “Rick” |
Expression | Result | Type | Note |
---|---|---|---|
COLLECT Person.name FROM ALL Person | [ "Kim" , "Rick" , "Bob" ] | String (multivalued) | A result never contains duplicate values |
SIZE ( COLLECT Person.name FROM ALL Person ) | 4 | Integer | A subexpression can contain duplicate values |
SIZE ( UNIQUE ( COLLECT Person.name FROM ALL Person ) ) | 3 | Integer | The collection holds three unique values |
Overview
Content Tools