You are viewing the documentation for Blueriq 16. Documentation for other versions is available in our documentation directory.
UNPACK
Extracts the value from a single valued collection or list. Is the inverse of the LIST function.
Syntax
UNPACK ( collection/list )
Input
- collection/list - A collection or list of one entity or attribute instance.
Return type
- entity instance
- attribute value of any type
Examples
Suppose the following data model.
Person.name | Person.SequenceNumber |
---|---|
“Bob” | 654 |
“Jane” | 523 |
“Mary” | 667 |
“Rick” | 500 |
“Ron” | 490 |
“Jenny” | 765 |
UNPACK ( COLLECT Person.name FROM ALL Person WHERE ( Person.SequenceNumber = MIN ( COLLECT Person.SequenceNumber FROM ALL Person ) ) )
= “Ron”- In case a second entry "Ron","490" exists, the expression
UNPACK ( COLLECT Person.name FROM ALL Person WHERE ( Person.SequenceNumber = MIN ( COLLECT Person.SequenceNumber FROM ALL Person ) ) )
will fail, because theUNPACK
cannot resolve a list with two elements. To solve this theUNIQUE
function has to be used:UNPACK ( UNIQUE ( COLLECT Person.name FROM ALL Person WHERE ( Person.SequenceNumber = MIN ( COLLECT Person.SequenceNumber FROM ALL Person ) ) ) )
= "Ron". UNPACK ( COLLECT Person.name FROM ALL Person WHERE ( Person.SequenceNumber = MAX ( COLLECT Person.SequenceNumber FROM ALL Person ) ) )
= “Jenny”
Overview
Content Tools