![]() Previous |
![]() Next |
When you use a relation as the qualifier in the QDR, you replace a dimension of the variable with the dimension or dimensions of the relation. The relation must be related to the dimension that you are qualifying, and it must be dimensioned by the replacement dimension.
Replacing a Dimension in a Variable
Suppose you have two variables, sales
and quota
, which are dimensioned by month
, product
, and district
. A third variable, division
.mgr
, is dimensioned by month
and division
. You also have a relation between division
and product
, called division
.product
. These objects have the following definitions.
DEFINE sales VARIABLE DECIMAL <month product district> LD Sales Revenue DEFINE quota VARIABLE DECIMAL <month product district> DEFINE division.mgr VARIABLE TEXT <month division> DEFINE division.product RELATION division <product> LD Division for each product
The following statement produces the report following it.
REPORT division.mgr -------------------DIVISION.MGR---------------------- ----------------------MONTH-------------------------- DIVISION JAn02 Feb02 Mar02 Apr02 May02 Jun02 -------- -------- -------- -------- -------- -------- -------- Camping Hawley Hawley Jones Jones Jones Jones Sporting Carey Carey Carey Carey Carey Musgrave Clothing Musgrave Musgrave Musgrave Musgrave Musgrave Wong
Suppose you want to obtain a report that shows the fraction by which sales have exceeded quota and you want to include the appropriate division manager for each product. You can show the division manager for each product by using the relation division
.product
, which is related to division
and dimensioned by product
, as the qualifier. The QDR replaces the division
dimension with product
, so that it has the same dimensions as the other expression in the report sales
/ quota
. The following statement produces the report following it.
REPORT DOWN month sales W 6 sales/quota W 8 HEADING - 'MANAGER' division.mgr(division division.product) DISTRICT: BOSTON -----------------------------PRODUCT------------------------------------ ----TEnts---- ---canoes---- --racquets--- --sportswear-- ---footwear--- Sales/ Sales/ Sales/ Sales/ Sales/ Month Quota Manager Quota Manager Quota Manager Quota Manager Quota Manager ------ ----- ------- ----- ------- ----- ------- ----- -------- ----- -------- Jan02 1.00 Hawley 0.82 Hawley 1.02 Carey 0.91 Musgrave 0.92 Musgrave Feb02 0.84 Hawley 0.96 Hawley 1.00 Carey 0.80 Musgrave 1.07 Musgrave Mar02 0.87 Jones 0.95 Jones 0.87 Carey 0.88 Musgrave 0.91 Musgrave Apr02 0.91 Jones 0.93 Jones 0.99 Carey 0.94 Musgrave 0.95 Musgrave ...