collect_by_cond

relational-functions collect_by_cond

syntax

  • collect_by_cond(selection domain unit, condition, attribute)

definition

collect_by_cond(selection domain unit, condition, attribute) results in a the values of attribute attribute, with the selection domain unit as domain-unit, for which the values of the condition argument are true.

applies to

  • selection domain unit: a unit with value type of the group CanbeDomainUnit
  • condition: must be a boolean attribute or subexpression resulting in boolean values.
  • attribute: can be any attribute with the same domain unit as the condition argument

since version

8.8.0

example

unit<uint32> City: StorageName = "city.csv", StorageType = "gdal.vect", StorageReadOnly = "True"
{
   attribute<string> name;
   attribute<uint32> RegionCode;
}
unit<uint32> ZHCities := select_with_attr_by_cond(City, City/RegionCode == 200);

attribute<string> name (ZHCities) := collect_by_cond(ZHCities, City/RegionCode == 200, City/name);
City/RegionCode City/Name
100 Amsterdam
200 Rotterdam
300 Utrecht
200 Den Haag
400 Eindhoven
null Haarlem
400 Tilburg

domain City, nr of rows = 7

name
Rotterdam
Den Haag

domain ZHCities, nr of rows = 2

see also