Hierarchies

The Presentation library provides a declarative way to create hierarchies based on iModel data.

Reference

There are 2 primary concepts for creating hierarchies: rules and specifications.

Rules

Hierarchy presentation rule is a top level concept for defining hierarchies. There are two types of hierarchy rules:

The only difference between those two rules is that we're looking for root node rules when creating root level nodes and for child node rules otherwise.

Both kinds of rules have two types of attributes - for defining placement and for defining branch content.

Placement attributes

Placement attributes define if the rule should be used and where the nodes appear if it is.

Branch content attributes

Branch content attributes define what nodes are returned if the rule does get used after evaluating placement attributes. The most important branch content attribute is specifications, which is an array of 4 possible types of specifications:

  • Instance nodes of specific classes specification returns nodes for instances of given ECClass(-es) without attempting to join them to the parent node using some relationship or attribute. This is mostly useful when specifying root nodes.
  • Related instance nodes specification returns nodes for instances that are related to the parent instance node through given ECRelationship. This is the most commonly used specification to create child nodes.
  • Custom query instance nodes specification returns nodes for instances based on a given ECSQL query. Generally, this specification is rarely needed as majority of cases can be handled by Instance nodes of specific classes specification which is more performant and easier to set up.
  • Custom node specification returns a single node that's not based on data in the iModel. Instead, the specification itself specifies all the attributes (type, label, description, image, etc.) of the node.

Hierarchy customization

All general use customization rules can be applied to hierarchies. In addition, there are some hierarchy-specific customization rules:

External resources

Last Updated: 18 May, 2022