COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: hespora on 14 Mar 2016 04:41:59 AM

Title: Don't query data before prompts on report page are filled
Post by: hespora on 14 Mar 2016 04:41:59 AM
Hi there,

I'm trying to design an interactive report with prompts on the main report page (rather than a separate prompt page). However, I want to suppress cognos executing the main query until the prompts are actually used once and the reprompt button is clicked.

Of course, an obvious way would be to recreate all the prompts I'm using on a separate prompt page. Is there any way to avoid this?


Kind regards,
Mark.
Title: Re: Don't query data before prompts on report page are filled
Post by: BigChris on 14 Mar 2016 04:54:45 AM
I would have thought it would have to run the report / query in order to present the page.

One cunning wheeze I've used before now is to make the prompt page look like the prompt area from the report page...so it looks like it's doing what you want, but it's really presenting a prompt page. And of course you can just copy the prompts that you've already created on your report page into your prompt page...so you don't need to recreate anything.
Title: Re: Don't query data before prompts on report page are filled
Post by: Lynn on 14 Mar 2016 05:03:53 AM
Perhaps set default values for the prompts that will yield no data and then style the no data area to be blank or to show some message.
Title: Re: Don't query data before prompts on report page are filled
Post by: hespora on 14 Mar 2016 08:56:27 AM
I think I'll go with setting defaults that will result in no data returned. Thanks for the input, both of you! :)
Title: Re: Don't query data before prompts on report page are filled
Post by: navissar on 14 Mar 2016 09:32:59 AM
There is another way. It does require some work though.

You can put all your report data in a conditional block (Or a block with a render variable). Then, you use JavaScript to populate a hidden prompt with a "Show" value when pormpts are first submitted, and use that hidden parameter to populate your variable.

There are also ways to do this without scripting, but these are specific and not general. For example, you could place the block with your report in a singleton assigned to a query that returns 0 rows if a mandatory parameter wasn't selected, and your variable will refers to the row count.