select_with_attr_by_org_rel

selection-functions select_with_attr_by_org_rel

syntax

  • select_with_attr_by_org_rel(src_tree_item, condition)
  • select_uint8_with_attr_by_org_rel(src_tree_item, condition)
  • select_uint16_with_attr_by_org_rel(src_tree_item, condition)
  • select_uint32_with_attr_by_org_rel(src_tree_item, condition)
  • select_uint64_with_attr_by_org_rel(src_tree_item, condition)

definition

select_with_attr_by_org_rel(src_tree_item, condition) results in a new domain-unit with a relation to the entries of the domain unit of the condition argument, for which the values of the condition argument are true. Additionally, all subitems from the src_tree_item argument with the same domain unit as the condition become subitems of the resulting select_with_attr_by_org_rel unit and with this resulting unit as new domain unit. The only exception is if the src_tree_item contains an org_rel subitem, this subitem is not added as it would be ambiguous with the new resulting org_rel attribute.

The resulting value-type of the domain unit is derived from the domain unit of the condition argument:

  • uint32 for conditions with uint32, boolean, spoint or wpoint value-type
  • uint8 for conditions with uint8 value type
  • uint16 for conditions with uint16 value type
  • uint64 for conditions with uint64, ipoint or upoint value type

The explicit select_uint8_with_attr_by_org_rel, select_uint16_with_attr_by_org_rel, select_uint32_with_attr_by_org_rel and select_uint64_with_attr_by_org_rel functions can be used in the same manner as the select_with_attr_by_org_rel function, to create a new domain unit with the explicit value type.

Between versions 8.6.0 and 8.7.2 the name select_afew was used for the select_with_attr_by_org_rel function.

description

The select_with_attr_by_org_rel function generates a subitem, named org_rel. This data-item contains the relation towards the domain unit of the condition argument.

The select_with_attr_by_org_rel function is efficient for small selections, think about selection with less than 3% of the entries of the original domain. For larger selections, the select_with_attr_by_cond function is advised.

The org_rel data-item can be used in a lookup function to relate attributes to the new domain unit.

See this overview for when to choose which selection operator is feasable.

applies to

  • condition must be a boolean attribute or subexpression resulting in boolean values.

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)
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

ZHCities/name ZHCities/regionCode ZHCities/org_rel
Rotterdam 200 1
Den Haag 200 3

domain ZHCities, nr of rows = 2

The subitems: name, regionCode and org_rel are generated by the configured select_with_attr_by_org_rel function.

see also