COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: hwmohrmann on 03 Jul 2014 10:28:28 AM

Title: Pass string value from Master to Detail Report
Post by: hwmohrmann on 03 Jul 2014 10:28:28 AM
I have a detail report called by several different Master reports.
The Master reports summarize the information in different ways, and the detail report shows all the detail records.
What I would like to do is simply pass the Master report Name to the Detail report so that I can show the calling report Name in the Detail report.

I am new to Cognos Reports so I am hardly an expert.
I have spent hours Googling this with no luck.

Is there a simple way to do this?
Thanks in advance.
Title: Re: Pass string value from Master to Detail Report
Post by: cognostechie on 03 Jul 2014 01:54:27 PM
No need to feel bad if you are not an expert, that's what these forums are for.

There is a report name function available in Report Studio. I think it is ReportName () . If you
create a data item and insert this function and then pass the 'Data Item value' to the detailed
report, it should work.  I don't have RS open right now but give it a try, it should work.
Title: Re: Pass string value from Master to Detail Report
Post by: hwmohrmann on 03 Jul 2014 02:16:31 PM
The ReportName() function returns the name of the current report.
There is no way to set the name or any way to pass the name from the Master to the Detail.
Title: Re: Pass string value from Master to Detail Report
Post by: cognostechie on 03 Jul 2014 03:15:22 PM
I don't have access to RS right now but if nothing else, you can always create a data item and put the report name in there and pass it. I was just trying to make it dynamic. If your report name is 'Master 1 Report' then just put that in the data item and pass the Data item value. Since this will be string, it will definately get passed on
Title: Re: Pass string value from Master to Detail Report
Post by: cognostechie on 03 Jul 2014 03:46:50 PM
Here is the report xml for Master report. It works.

Title: Re: Pass string value from Master to Detail Report
Post by: cognostechie on 03 Jul 2014 03:47:23 PM
and here is the Detail report.
Title: Re: Pass string value from Master to Detail Report
Post by: hwmohrmann on 09 Jul 2014 09:31:11 AM
The problem that I always run into is this:
The report uses three values that are used as filters for the data: date range, program, item.

I add the Report Name data item to the detail.
I open the master and open the drill through and the new Report Name data item shows up.
I setup the data item and then run the Master report.
It asks for the date range and then displays.

I click the link to open the Detail report.
The detail opens a prompt and wants me to reenter the date range and to type in the Report Name.
For some reason adding the data item to the detail reports causes a linking problem between the Master and the Detail
I have even tried adding the Report Name as a dummy filter and that caused exactly the same problem.


.


No matter what I do the Detail always asks for the Report Name value.

Title: Re: Pass string value from Master to Detail Report
Post by: cognostechie on 09 Jul 2014 02:27:52 PM
I don't know how to help you. You are doing it wrong even after getting the report xml. Look at the report xml again of both the reports (master and detail) and try to understand it before you do anything.