COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: psrpsrpsr on 27 Mar 2018 03:12:05 PM

Title: How to display only pages that users select on the prompt page?
Post by: psrpsrpsr on 27 Mar 2018 03:12:05 PM
I have a report requirement to show only report pages that users select on the prompt page. What is the best practice in Cognos for allowing users select a prompt that outputs the desired pages? For example, each page aggregates to a different time frame, and they should be able to select one or more:

Monthly
| Location | Month  | Rate |
|----------|--------|------|
| NYC      | 201803 | 10%  |
| NYC      | 201802 | 9%   |
| ...      |        |      |

Weekly
| Location | Week      | Rate |
|----------|-----------|------|
| NYC      | 3/19/2018 | 12%  |
| NYC      | 3/12/2018 | 8%   |
| ...      |           |      |

Daily
| Location | Day       | Rate |
|----------|-----------|------|
| NYC      | 3/26/2018 | 22%  |
| NYC      | 3/25/2018 | 4%   |
| ...      |           |      |


Thank you
Title: Re: How to display only pages that users select on the prompt page?
Post by: hespora on 28 Mar 2018 03:51:09 AM
Hi psr,


here's how I am doing that:
- For each page that I want to be togglable, prompt page has a value prompt (so if you want three togglable pages, three prompts).
- prompt UI is "check box group"
- each prompt has a single static choice. From your example, I'm going to show how to make the monthly page togglable, but the others work just the same
- the prompt is assigned to a parameter pShowMonthly
- Prompt gets a single static choice "Show Monthly Page"
- setup a boolean variable "vShowMonthly", defined as "ParamDisplayValue('pShowMonthly') = 'Show Monthly Page'"
- this boolean variable is then assigned to be the render variable for the page.

That's one way to do it. There are many others, I'm sure, and also I've used others, but only when *sets* of pages should correspond to roles of report recipients. If you want to do single pages, I believe the above would be as close to best practice as possible.
Title: Re: How to display only pages that users select on the prompt page?
Post by: BigChris on 28 Mar 2018 05:19:48 AM
As Hespora says, there are many ways to do what you describe. My method is similar to hespora's, but I'd use a single prompt called prmPages, with static values in it. let's say we've got the situation you laid out. In my prompt I'd have three values 'Daily', 'Weekly' 'Monthly'. I'd then have three pages in the report:pageDaily, pageWeekly, pageMonthly

After that I'd create three variables, along the lines of ParamDisplayValue('prmPages') contains 'Daily' and use that as a render variable for each page
Title: Re: How to display only pages that users select on the prompt page?
Post by: Wangd on 25 Jul 2018 07:35:54 PM
I am new to the forum.  I have a similar question. I am able to get the report to open the different pages depending on the prompt value.  However, I need the pages in different formats.  For example, the 1st and 2nd pages will be in PDF and the 3rd page will be in Excel.  I have a value prompt with PDF and Excel as the value.  How should I do that?

Thanks!
Deanna
Title: Re: How to display only pages that users select on the prompt page?
Post by: hespora on 26 Jul 2018 02:26:08 AM
- in your report, go to variables
- create a new string variable "output"
- for that variable, add the two values "PDF" and "spreadsheetML"
- in your report, go to pages
- select a page to be rendered in pdf. in properties, select Render Variable. Specify the "output" variable, and un-tick "spreadsheetML" value
- for excel pages the same, but un-tick "PDF" value

For that to work, you're going to need to run your report in background rather than interactive, and select both Excel 2007 format and PDF format.
Title: Re: How to display only pages that users select on the prompt page?
Post by: dougp on 26 Jul 2018 11:14:03 AM
Wangd:  Keep it simple.  Since this can't be done by running the report interactively, make it two reports.  You can create a job that runs both reports.
Title: Re: How to display only pages that users select on the prompt page?
Post by: Wangd on 27 Jul 2018 01:20:35 PM
Thank you everyone for the suggestion.  I got my report to work.  Here is what I did:
1. Create a prompt page that allows selection of formats. Some java scripts are involved.
2. Create another prompt page for other prompts.  I wish I could put these into the first prompt page too.  If anyone knows how to do it, please let me know.
3. Create 2 pages that are tied to the same query.
4. Create 2 string variables utilizing the ReportOutput() function. One has the value of PDF and the other has the value of SpreadsheetML.(This was my problem before.  I used Excel as the value.)
5. In the Renter Variable property for the first page, select the variable for output to PDF. In the 2nd page, select the variable for output to Excel.
When I run the report, depending on which format I pick on the first prompt page, it will open the corresponding page.
Title: Re: How to display only pages that users select on the prompt page?
Post by: Zedief on 31 Jul 2018 12:46:15 PM
Hello everyone! I'am a newbie and i had a similar issue.
I already use a render variable to show the page that the user choose, with simply pages it works properly.
It doesn't work with set of pages.
I had a one page , everything works fine then I create a section for an element of the list containing in the page and set pages break for the section element,
when I run the report and choose to run this set of pages it return a report ( .xlsx in the fact ) that contain multiple sheet everyone equal to other, why?  :o
Thank for the help!