Unique
relational-functions unique
syntax
- unique(a)
definition
unique(a) results in a new uint32 domain-unit with the unique occurences of attribute a.
description
The unique function generates a subitem, named Values. This data-item contains the unique occurences of attribute a, sorted ascending.
The Values data item can be used in a lookup (in case attribute a is a relation) or a rjoin function, to relate attributes to the new domain unit, see the example.
applies to
- attribute a with Numeric, Point, uint2, uint4, bool or string value type
example
unit<uint32> Region := unique(City/RegionCode)
{
attribute<string> name := rjoin(Values, City/RegionCode, City/RegionName);
}
City/RegionCode | City/RegionName |
---|---|
100 | Noord Holland |
200 | Zuid Holland |
300 | Utrecht |
200 | Zuid Holland |
400 | Noord Brabant |
null | null |
400 | null |
domain City, nr of rows = 7
Region/Values | Region/name |
---|---|
100 | Noord Holland |
200 | Zuid Holland |
300 | Utrecht |
400 | Noord Brabant |
domain Region, nr of rows = 5