Skip to content
mtbeek32 edited this page Jan 15, 2023 · 9 revisions

Aggregation functions first

syntax

  • first(a)
  • first(a, relation)

definition

applies to

  • attribute a with Numeric, Point, string or bool value type
  • relation with value type of the group CanBeDomainUnit

conditions

  1. The values unit of the resulting data item should match with regard to value type and metric with the values unit of attribute a.
  2. The domain of argument a and relation must match.

example

parameter firstNrInh    := first(City/NrInhabitants);  result = 550
parameter firstCityName := first(City/CityName);       result = ‘Amsterdam’
parameter   firstIsCap    := first(City/IsCapital);      result = True

attribute firstNrInhRegion    (Region) := first(City/NrInhabitants, City/Region_rel);
attribute firstCityNameRegion (Region) := first(City/CityName,      City/Region_rel);
attribute   firstIsCapital      (Region) := first(City/IsCapital,     City/Region_rel);
City/NrInhabitants City/CityName IsCapital City/Region_rel
550 Amsterdam True 0
525 Rotterdam False 1
300 Utrecht False 2
500 DenHaag False 1
200 Eindhoven False 3
175 Haarlem False null
null null False 3

domain City, nr of rows = 7

firstNrInhRegion firstCityNameRegion firstIsCapitalRegion
550 Amsterdam True
525 Rotterdam False
300 Utrecht False
200 Eindhoven False
null null False

domain Region, nr of rows = 5

see also

Clone this wiki locally