Min_index - ObjectVision/GeoDMS GitHub Wiki
Aggregation functions min_index
- min_index(a)
- min_index(a, relation)
- min_index(a) results in a parameter with the index number of the minimum value of the non null values of attribute a.
- min_index(a, relation) results in an attribute with the index numbers of the minimum values of the non null values of attribute a, grouped by relation. The domain unit of the resulting attribute is the values unit of the relation attribute.
The min_index function is not defined for string data items.
- attribute a with Numeric, Point or boolean value type
- relation with value type of the group CanBeDomainUnit
The values unit of the resulting data item should be the domain unit of argument a.
A value is taken only when it is below the largest value of its value type, so for an attribute, or a group of the relation, whose values all equal that largest value, min_index results in null.
7.184
- Without relation: O(n) where n = number of elements in the domain of a. Single pass tracking minimum value and its index.
- With relation: O(n) where n = number of elements in the domain of a. Tracks minimum value and index per group during a single pass.
parameter<City> min_index_NrInh := min_index(City/NrInhabitants); result = 5
attribute<City> min_index_NrInhRegion (Region) := min_index(City/NrInhabitants, City/Region_rel);
| City/NrInhabitants | City/Region_rel |
|---|---|
| 550 | 0 |
| 525 | 1 |
| 300 | 2 |
| 500 | 1 |
| 200 | 3 |
| 175 | null |
| null | 3 |
domain City, nr of rows = 7
| min_index_NrInhRegion |
|---|
| 0 |
| 3 |
| 2 |
| 4 |
| null |
domain Region, nr of rows = 5