Hierarchize

Returns members of a set in their hierarchical order as represented in the database outline.

Syntax

Hierarchize ( set [,POST] )
ParameterDescription

set

Set specification.

POST

If this keyword is used, child members are returned before their parents.

Notes

This function returns members of a set in their hierarchical order as represented in the database outline (viewed from top-down by default, meaning that parent members are returned before their children).

If POST is used, child members are returned before their parents (the view changes to bottom-up). For example,

Hierarchize({Child, Grandparent, Parent})

returns {Grandparent, Parent, Child}.

Hierarchize({Child, Grandparent, Parent}, POST)

returns {Child, Parent, Grandparent}.

Example

Example 1

The following expression

Hierarchize({May, Apr, Jun})

returns the set:

{Apr, May, Jun}

Therefore, the following query

Select 
Hierarchize({May, Apr, Jun})
on columns from sample.basic

returns the grid:

AprMayJun
864489299534

Example 2

The following expression

Hierarchize({May, Qtr2, Apr, Jun})

returns the set:

{ Qtr2 Apr May Jun }

Therefore, the following query

Select 
Hierarchize({May, Qtr2, Apr, Jun})
on columns from sample.basic

returns the grid:

Qtr2AprMayJun
27107864489299534

Example 3

The following expression

Hierarchize({May, Qtr2, Apr, Jun}, POST)

returns the set:

{Apr, May, Jun, Qtr2}

Therefore, the following query

Select 
Hierarchize({May, Qtr2, Apr, Jun}, POST)
on columns from sample.basic

returns the grid:

AprMayJunQtr2
86448929953427107

Example 4

The following query

Select 
Hierarchize({Dec, Year, Feb, Apr, Qtr1, Jun, Qtr2}, POST)
on columns,
Hierarchize({Margin, Sales})
on rows
from sample.basic

returns the grid:

(axis)FebQtr1AprJunQtr2DecYear
Margin177625294318242194575631718435221519
Sales3206995820329173508810167933342400855