Quickly changing drill targets

While the project is in the development stage, many things change. Files are moved, folders are renamed, and sometimes requirements change. This often results in re-work.

Assume that a crosstab report has been designed to drill to a target report from intersection. The drill target report accepts many parameters and their mapping is already done. However, because of some changes in business requirement, the drill from intersection now needs to go to another report. That report is already designed to accept the same parameters; we only need to change the target in the main report.

In this recipe, we will see how to quickly change the target report for a drill-through definition, without the need to map the parameters again.

Getting ready

Create a crosstab report shown as follows and save it as '5.1 Drill from crosstab intersection'.

Getting ready

Create drill-through link from the crosstab intersection to a list report and pass multiple values. This list report can be just a simple one shown as follows. Save this report as '5.1 Drill from crosstab intersection Drill 2'.

Getting ready

Create one more copy of the above report and save it as '5.1 Drill from crosstab intersection Drill 1'.

So, now we have the following folder structure:

Getting ready

The main report (5.1 Drill from crosstab intersection) has been designed to call '5.1 Drill from crosstab intersection Drill 2'. We will change it to call 'Drill 1' instead by editing XML. This way we will not have to define the parameter mapping again and it will save the developer's time.

How to do it...

  1. Open the main report in Report Studio.
  2. Unlock the report objects and select crosstab intersection. Hit the 'drill-through' button on the toolbar and examine the drill-target.
    How to do it...

    Notice that the drill through has been designed to go to 5.1 Drill from crosstab intersection Drill 2 and passes two parameters called Month and OrderMethod. In real life, you will usually have many parameters passed.

  3. Now close the dialog. Choose Tools | Copy Report to Clipboard option from menu. This will copy the XML specification of the report on clipboard.
    How to do it...
  4. Open any text editor or XML editor, and paste the XML spec.
  5. Now go to Cognos Connection. For the 5.1 Drill from Crosstab intersection Drill 1 report, click on Set Properties button.
    How to do it...
  6. Click on the View search path link.
    How to do it...
  7. A dialog-box will pop up with following information. Select the Search path and copy it.
    How to do it...
  8. Go back to the XML specification pasted in the text or XML editor. Replace all the report paths referring to Drill 2 with that of Drill 1. In our recipe, we will search for all instances of :
    '/content/package[@name='GO Data Warehouse (query)']/folder[@name='Chapter 5']/report[@name='5.1 Drill from crossab intersection Drill 2']' 

    and replace them with :

    '/content/package[@name='GO Data Warehouse (query)']/folder[@name='Chapter 5']/report[@name='5.1 Drill from crossab intersection Drill 1']'
  9. Now copy the whole XML specification (modified one) on the clipboard.
  10. Go back to Report Studio and choose the Tools | Open Report from Clipboard option.
    How to do it...
  11. Check the drill through target again. It should be changed to Drill 1 with all the parameter still mapped correctly.
    How to do it...
  12. Save the report as the main report.

How it works...

In Report Studio, if you change the target report for an existing drill-through definition, then it wants to redefine the parameter mapping. Here we are achieving that without the need to redefine the mapping.

For that we are directly modifying the XML specification of the report. When we copy a report to clipboard, its XML spec is copied. We then edit it in an editor, and replace all the references to 'Drill 2' report with 'Drill 1' report.

Finally, we copy the modified the XML back into Report Studio and find that the drill target is successfully changed.

There's more...

It is advisable to use an XML Editor rather than normal Text Editor as it allows you to understand the tags better and hence reduce the chances of errors.

You can explore <reportDrills> tag more and try changing different properties/members within that.

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

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