Conditional drill-through

Cognos Report Studio allows you to define drill-through. However, there is no facility to define conditional drill-through. This recipe will show you how to achieve it.

We will use the report created in the previous recipe for this. We will create drill through from the crosstab intersection to a dummy report (drill 1). Then we will try to achieve a conditional drill-through to another report (drill 2) for certain months.

Getting ready

Create two dummy reports called Drill 1 and Drill 2.

Open the report created in previous recipe in Cognos Report Studio.

How to do it...

  1. First of all create drill-through from the crosstab intersection to the first report (Drill 1). We saw how to create such drill in earlier chapters of this book.
  2. Now select the text item from crosstab intersection, hold Ctrl key on the keyboard and drag the text item a little to the left. This will create a copy of this text item within same intersection.
    How to do it...
  3. For this newly created copy of the text item, update the drill-through link to point to Drill 2.
  4. Now we will define the condition to switch between the links. Create a Boolean variable called Is_2004. Define the condition as: [Query1].[Current Month] contains '2004'
    How to do it...
  5. Go back to the report page. Attach the conditional variable Is_2004 as Style Variable to both the drill links.
  6. Using Conditional Explorer, set the Box Type to None for the left link when Is_2004 is Yes and same for the right link when Is_2004 is No.

    That is, turn the visibility off for one of the links, depending on the condition.

  7. Run the report to test it.

How it works...

Within the drill-through definitions dialog box, there is no reference to the conditional variables. So, Report Studio provides no direct way to switch the drill target depending on a condition.

As a solution, we are creating a copy of the text item here and then we hide one of them based on a condition. As the text items go to different targets, we achieve conditional drill-through in the report.

There's more...

Instead of using the Style Variable and Box Type, we can use Render Variable to directly set when the item should be visible. However, in order to use Render Variable, we will need to use String Variable instead of Boolean.

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

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