Friday, October 26, 2007

Master Detail Query

Hi,
Today i got a chance to create/modify one report. I need to add one Master/Detail functionality in that report.

Below are my learnings regarding Master/Detail report.

There are 2 types of Master Detail Query:

1) Filterized Detail Query
2) Parameterized Detail Query

Steps to Create Master Detail Query in Cognos ReportNet:

A master-detail query is an outer join. It is useful when you want to include ALL records in the master query regardless of whether there are matching records in the detail query or not. (These instructions are based on CRN V7 MR3.)
1. On a blank report page, drag in a new list item (called MasterQuery in this example). Populate it as needed.
2. Drag in a new list item (called DetailQuery in this example) and drop it into one of the columns of the MasterQuery list. Populate this list as needed. One of these fields (called ID in this example) must be related to an associated field in the MasterQuery list to link the two queries. This step must be done correctly to allow DetailQuery to be an available selection in Step 5 below.
3. On the Menu Bar, select Data > Master/Detail Relationships...
4. Select MasterQuery in the top listbox.
5. Add DetailQuery as a filtered query and set MasterQuery.ID=DetailQuery.ID. If DetailQuery is not shown as an available detail query selection, then double-check that you performed Step 1 correctly.
6. Run your report.

Some further notes:
1) You can add multiple detail queries to a single master query. You can enhance the appearance of the report by hiding the detail query list headers as desired.
2) When you have Stored Procedures in the back end, Filterized Detail Query won’t work in case of Master Detail Reports.
3) By Default in the window where you choose your detail query. It will list all the queries in the report which uses parameter.

Will meet you soon in my next blog with more learnings.

Bye

No comments: