COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: bonniehsueh on 31 Jul 2017 05:37:42 PM

Title: SOLVED: Render Report Page Based on Prompt
Post by: bonniehsueh on 31 Jul 2017 05:37:42 PM
I am trying to render report pages based on a prompt. The prompt values are static choices are summary, detail. For simplicity, I use a boolean variable.

Created a variable with expression: ?pReportType? = 'summary'

When true, then page 1 should show, when false page 1 should not show. I get the error below.

The following expression is not valid: ?pReportType? = "all". If the item exists in a query but is not referenced in the layout, add it to a property list. CRX-API-0005 An error occurred at or near the position '0'. The variable named '?pReportType?' is invalid.

I've tried adding the prompt to each pages and setting the prompt default value. For example, for the summary page, ill set the default value to 'summary'.  This should meet the variable condition. 
Also assigned the pages to a query and created a calculated data item with the values hard coded so that I can add it to the property list of the query. 

I have done this in the past and for some reason is not working for me anymore. 

Any suggestions appreciated!
Title: Re: Render Report Page Based on Prompt
Post by: johnwilkinson on 31 Jul 2017 05:52:09 PM
You're making it more complicated than it needs to be. Make it a string variable with possibilities "page1" and "page 2". Create a variable with "ParameterValue(paramname)". Assign render variable to the pages - tick the page 1 value for page 1, page 2 value for page 2


Sent from my iPhone using Tapatalk
Title: Re: Render Report Page Based on Prompt
Post by: bonniehsueh on 31 Jul 2017 05:58:53 PM
Thanks for your quick response John!! Was writing an update with the solution just now. You hit it on the head! Just had to change the variable expression to paramvalue(pReportName) instead of ?pReportName? = 'summary'.  None of the other techniques were necessary.