collect_attr_by_org_rel

relational-functions collect_attr_by_org_rel

syntax

  • collect_attr_by_org_rel(tree_item, selection domain unit, org_rel)

definition

collect_attr_by_cond(tree_item, selection domain unit, org_rel) results in a new container with all subitem from the src_tree_item argument with the same domain unit as the values-unit of the org_rel argument. The org_rel attribute is used in lookup expressions 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 attribute have the same values units and composition as the source attributes, expression are made with the lookup function for each new attribute. This works similar to the select_afew function, with as difference that the collect_attr_by_org_rel does not create a new domain unit.

Between versions 8.5.2 and 8.7.2 the name relate_attr was used for the collect_attr_by_org_rel function.

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
  • org_rel a relation from the domain unit argument toward the domain unit of the attributes to be collect_attr_by_org_rel.

since version

8.8.0

example

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

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

container attributes_ZHCities := collect_attr_by_org_rel(City, ZHCities, ZHCities/org_rel);
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_org_rel function.

see also