relational-functions collect_attr_by_cond


  • collect_attr_by_cond(tree_item, selection domain unit, condition)


collect_attr_by_cond(tree_item, selection domain unit, condition) results in a new container with all subitems from the src_tree_item argument with the same domain unit as the condition argument. The condition is applied to select a set of elements of the original domain, this set is defined by the second argument: selection domain unit. This selection domain unit becomes the domain unit of the collected attributes.

The resulting attributes have the same values units and composition types as the source attributes, expressions are made with the lookup function for each new attribute. This works similar to the collect_attr_by_org_rel function, with as difference that the collect_attr_by_cond does not use an org_rel item.

applies to

  • tree_item can by any tree-item, but usually a unit or container
  • domain unit a unit with value-type of the group CanbeDomainUnit
  • condition must be a boolean attribute or subexpression resulting in boolean values.

since version



unit<uint32> City: StorageName = "city.csv", StorageType = "gdal.vect", StoragReadOnly = "True"
   attribute<string> name
   attribute<uint32> RegionCode;

unit<uint32> ZHCities := select_with_attr_by_cond(City, City/RegionCode == 200);

container attributes_ZHCities := collect_attr_by_cond(City, ZHCities, City/RegionCode == 200);
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

attributes_ZHCities/name attributes_ZHCities/regionCode
Rotterdam 200
Den Haag 200

domain ZHCities, nr of rows = 2

The subitems: name and regionCode are generated by the configured collect_attr_by_cond function.

see also