Sample 19: Narrowing Member Selection Criteria

The following report demonstrates the use of the LINK command to narrow the members returned in a selection in a report script. For a examples of use of the LINK command, see "Selecting Members by Using Boolean Operators" in the Designing and Maintaining Essbase Cubes.

               Market Measures Scenario 

                             Qtr1     Qtr2 
                         ======== ======== 

        100-10              5,096    5,892 
        100-20              1,359    1,534 
        100-30                593      446 
        200-10              1,697    1,734 
        200-20              2,963    3,079 
        200-30              1,153    1,231 
        200-40                908      986 
        300-10              2,544    3,231 
        300-20                690      815 
        300-30              2,695    2,723 
        400-10              2,838    2,998 
        400-20              2,283    2,522 
        400-30               (116)     (84)
        100-20              1,359    1,534 
        200-20              2,963    3,079 
        300-30              2,695    2,723 
            Product        24,703   27,107 

Use the following script to create Sample 19:

<Page (Market)
<Column (Year)
Qtr1 Qtr2
<Row (Product)
<Link (<UDA (product, naturally-flavored) OR <LEV (product, 0))
    ! 

The LINK command uses the AND, OR, and NOT Boolean operators to refine the search. In the preceding example, the product with the "naturally-flavored" user-defined attribute (UDA), as well as all Level 0 products, are returned in the search.

Be careful how you group operators in the LINK expression. Essbase evaluates operators from left to right. Use parentheses to group the expressions. For example, A OR B AND C is the same as ((A OR B) AND C). In the first expression, Essbase evaluates the expression from left to right, evaluating A OR B before evaluating AND C. In the second expression, Essbase evaluates the subexpression in parentheses (A OR B) before the whole expression, producing the same result. However, if you use (A OR (B AND C)), Essbase evaluates the subexpression in parentheses (B AND C) before the whole expression, producing a different result.

This report script, LINK.REP, is available in the \ARBORPATH\App\Sample\Basic directory.