$set.singleElement()
Unpacks a one-element set by returning the only element as the result. If the input is null, or the empty set, the result is null. If the set contains multiple elements, then an error is returned.
See also Pack.
| Name | Type | Description | Mandatory | Default |
|---|---|---|---|---|
| set | Set | A set or list with only one element to be unpacked. Multi-element sets are not allowed. | yes |
Type: Number/string/boolean/businss object
The element contained in set or null, if the input was null or the set was empty.
list(1).singleElement()
Output: 1
none().singleElement()
Output: null
The empty set created by none() has no element to unwrap.