![]() Previous |
![]() Next |
A gidrel relation is a relation between a NUMBER dimension, the hierarchical dimension, and the hierlist dimension that contains the grouping ID of each dimension member in each hierarchy of the hierarchical dimension. It also has a $GID_DEPTH property that identifies the depth within a hierarchy of each dimension member.
Example: Defining and Populating a gidrel Relation named geog_gidrel illustrates defining and populating this type of relation.
Example 1-10 Defining and Populating a gidrel Relation named geog_gidrel
"Create a dimension that has values that are numbers
DEFINE gid_dimension DIMENSION NUMBER (38,0)"Add values to that dimension
"This example uses MAINTAIN ADD to add a few numbers
MAINTAIN gid_dimension ADD 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
"Define the gidrel relation
DEFINE geog_gidrel RELATION gid_dimension <geog geog_hierlist>
"Display the complete definition of the geog_gidrel relation
"Note that it has no properties
DEFINE GEOG_GIDREL RELATION GID_DIMENSION <GEOG GEOG_HIERLIST>
"Populate the gidrel relation using the GROUPINGID command
GROUPINGID geog_parentrel INTO geog_gidrel USING geog_levelrel INHIERARCHY geog_inhier
"Display the values of the geog_gidrel relation
REPORT down geog w 20 geog_gidrel
---------------GEOG_GIDREL---------------
--------------GEOG_HIERLIST--------------
GEOG Political_Geog Sales_Geog
-------------- -------------------- --------------------
Boston 0 0
Springfield 0 0
Hartford 0 0
Mansfield 0 0
Montreal 0 0
Walla Walla 0 0
Portland 0 0
Oakland 0 0
San Diego 0 0
MA 1 1
CT 1 1
WA 1 1
CA 1 1
Quebec 1 1
East NA 3
West NA 3
All Regions NA 7
USA 3 NA
Canada 3 NA
All Country 7 NA
"Display the complete definition of the geog_gidrel relation
"Note that it now has a $GID_DEPTH property
DEFINE GEOG_GIDREL RELATION GID_DIMENSION <GEOG GEOG_HIERLIST>
PROPERTY '$GID_DEPTH' 4