GROUPINGID function

The GROUPINGID function retrieves a grouping id for the value of a hierarchical dimension using a grouping relation previously created by the GROUPINGID command.

Return Values

NUMBER

Syntax

GROUPINGID (gidrel...)

Arguments

gidrel

A grouping id relation for the hierarchical dimension that you previously created using the GROUPINGID command.

Examples

Example 7-106 Retrieving the Value of a Single GroupingID

Assume that you have use the GROUPINGID command to define grouping ids for the two hierarchicies in the geog dimension as described in Example 9-144, "Using GROUPINGID Command to Populate a Relation with Grouping Ids". Now you can use the GROUPINGID function to retrieve the grouping id of a value in the geog dimension.

" For the Political Geog hierarchy
LIMIT geog TO 'Hartford'
LIMIT geog_hierlist TO 'Political_Geog'
SHOW GROUPINGID(geog_gidrel)
0.00
SHOW OBJ(PROPERTY '$GID_DEPTH' 'geog_gidrel')
4
LIMIT geog TO ALL
LIMIT geog TO 'Canada'
SHOW GROUPINGID(geog_gidrel)
3.00
SHOW OBJ(PROPERTY '$GID_DEPTH' 'geog_gidrel')
4
 
" For the Sales Geog hierarchy
LIMIT geog TO 'Hartford'
LIMIT geog_hierlist TO 'Sales_Geog'
SHOW GROUPINGID(geog_gidrel)
0.00
SHOW OBJ(PROPERTY '$GID_DEPTH' 'geog_gidrel')
4
LIMIT geog TO ALL
LIMIT geog TO 'West'
SHOW GROUPINGID(geog_gidrel)
3.00
SHOW OBJ(PROPERTY '$GID_DEPTH' 'geog_gidrel')
4