Alternating drill link

In this recipe, we will learn about a limitation of drill link and overcoming it using Render Variable.

There is a crosstab report which shows sales quantity by month and order method. We need to provide drill-through facility from the intersection. However, the drill-through target needs to be different, depending on the order method.

If order method is e-mail, the drill-through from intersection should go to a report called 'Alternating Drill Link—Drill Report 2'. For all other order methods, it should go to 'Alternating Drill Link—Drill Report 1'.

Getting ready

Create a crosstab report to serve as the main report. Drag Month (shipment) on rows, Order method on columns and Sales Quantity on the intersection.

Create two list reports to serve as drill reports. In the sample provided with this book, we have used two list reports for this. One accepts the Order method and Month. The other accepts only month and is designed to work for the order method 'E-mail'.

How to do it...

  1. As already learnt in Chapter 2, create a drill through to first drill the report from the crosstab intersection.
    How to do it...
  2. Now make sure that the report objects are unlocked. Select the intersection text item (which now looks like hyperlink as there is already a drill-through defined). Hold the Ctrl key down and drag the text to its right within a cell.
  3. This should create a copy of the text item within that cell and will look like the following:
    How to do it...
  4. Now select this copy of the text item. Hit the drill-through button to open definitions. Delete the existing drill-through to first report. Create a new drill to a second report.

    So, now we have two text items in the cell, each going to different drill reports.

  5. Create a string type of Conditional Variable. Define it as:
    if ([Query1].[Order method] = 'E-mail') then ('E-mail')
    else ('Other')

    Call it OrderMethod and define the two values to be E-mail and Other.

    How to do it...
  6. Now go back to the report page. Select the first text item from intersection. Open its Render Variable property. Choose the OrderMethod variable and select to Render for: Other.
    How to do it...
  7. Similarly, define Render Variable for the second text item, but choose to Render for: E-mail.
  8. Run the report to test it. You will see that clicking on the intersection numbers opens first drill report for any order method other than E-mail. Whereas for the numbers under E-mail, the second drill report opens.

How it works...

First, let me explain to you the limitation here. CRS allows us to define multiple drill targets for an item. However, there is no facility to define a conditional target. So, if we define two targets, Cognos will ask users to select one at the run-time.

In our scenario, we want Cognos to go straight to one of the two targets depending on the order method condition. For that we are using the Render variable property.

Render variable

This property allows us to attach a conditional variable to the report object and define the conditions for which the object will be rendered.

This works best with String variables. For a Boolean type of conditional variable, rendering is possible only for 'Yes'.

Instead of defining two targets on same text item, we are creating two text items and controlling their rendering.

There's more...

Even with String type of conditional variable, rendering cannot be defined for the default (Other) condition. Hence, we had to define our own 'Other' condition.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset