COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: dax on 04 May 2013 08:13:45 PM

Title: Pass string parameter from one report to another
Post by: dax on 04 May 2013 08:13:45 PM
Hi everyone

I am having issues getting a drill through report to work correctly.  I am working with Report Studio 10.1.1.  I have a package that includes two different time dimensions - one is "As Of Period" and one is "Time Period".  The first report I'm using is based on the "As Of Period" and I want to drill through to a second report that is using the "Time Period" dimension.  I'm not able to pass the "As of Period" to the second report as I get the following error message:

The member '[Business View].[As of Period].[As of Period].[Month]->[all].[116]' does not belong to '[Business View].[TIme Period].[Time Period].[Month]'.

This makes sense to me.  So I have been trying to figure out a workaround and am trying to use the RoleValue function to pass an appropriate string to the target report - so I've got this as a filter in the target report:

roleValue ('_memberCaption',[Business View].[TIme Period].[Time Period].[Month])=?pPeriodCaption?

If I run this report on its own it prompts me for a string value and I can enter something like '2013 - Mar' (without the apostrophes) and the report runs and gives the correct results.  So I'm trying to expand on this idea and create a "string" data item in the first report and then use that data item as the parameter when I define the drill through definition.

In my first report I have defined a data item named MyPeriod that simply has this as its expression:

'2013 - Mar'

I then set up the drill through to the target report - the RoleValue parameter I have in my target report is showing up as string type parameter - I then choose Method = Pass Data Item Value and Value = MyPeriod and Property to Pass = (Default)

When I run the report though I am still being prompted for the pPeriodCaption prompt in the target report so for some reason Cognos is not recognising MyPeriod as a valid string that can be used by the pPeriodCaption prompt.

I have been playing around with this for days and I cannot get it to work - can anyone please provide any insight into what I might be doing wrong?  I hope I have provided enough information but let me know if not.  I am really keen to get this solved as it is the last issue I have in a number of reports that otherwise work very well.

Thanks  :)
Dax




Title: Re: Pass string parameter from one report to another
Post by: CognosPaul on 05 May 2013 02:51:27 AM
Are you including the calculated field in the properties of the data container? A drillthrough definition alone won't force Cognos to include the field, and without it Cognos will simply run the drillthrough without warning that it's not passing the field.
Title: Re: Pass string parameter from one report to another
Post by: dax on 05 May 2013 06:00:21 AM
Paul

Thank you very much - that is exactly what the problem was.  I added the data item to the properties property and it works exactly as I need.  I think that is probably the cause of some of the other issues I've been having elsewhere (i.e. data item not on report but referred to somewhere).

Anyway, thanks again :)

Dax
Title: Re: Pass string parameter from one report to another
Post by: IceTea on 06 May 2013 09:56:50 AM
For this kind of problems, it's very helpful to do a layoutexpression in the drilltargetreport with "Paramdisplayvalue" and Paramvalue" function on such parameters so you can see exactly, what value is in there.
Title: Re: Pass string parameter from one report to another
Post by: dax on 06 May 2013 05:18:22 PM
Hi IceTea

I have used that technique in certain cases but not sure how i would use it for this problem - the parameter value would be what I type into the generated prompt, would it not?

Thanks
Dax
Title: Re: Pass string parameter from one report to another
Post by: IceTea on 07 May 2013 03:02:00 AM
Quote from: dax on 06 May 2013 05:18:22 PM
Hi IceTea

I have used that technique in certain cases but not sure how i would use it for this problem - the parameter value would be what I type into the generated prompt, would it not?

Thanks
Dax

You're absolutely right.

For this case i create quickly a new blank test report, add the layout calculations (maybe u have to create a parameterbox manually so the drill recognizes a parameter in the blank target report) and change the drill at the source report to this test report. This is just a little workaround, but helps in some cases.