COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ordotan on 28 Jul 2013 01:35:52 AM

Title: Customized-prompt page based on DB values in Cognos 10.2.0
Post by: ordotan on 28 Jul 2013 01:35:52 AM
Hi,

I need to create a customized-prompt page, based on variables (render+style) that are derived from configuration tables in my DB.

I am trying to do it with "hidden" prompt page, that uses javascript to select some values from the DB, and then automatically redirects to the prompt page itself.

For the automatic redirection I'm using "promptButtonNext();". However, when I'm re-running the report (after getting the results) instead of showing again the prompt-page, it skips it, and brings me back to the report page.

If I'm removing "promptButtonNext();" from the script, and uses a mannual "Next" button on the "hidden" prompt page, it works, and I'm getting to the prompt-page as expected

What am I doing wrong ? Is there a better way implemeing what I'm trying to achieve?

Thanks,
Or

p.s. - This scripts works OK in cognos 8.2.. But I'm getting this error in cognos 10.2
Title: Re: Customized-prompt page based on DB values in Cognos 10.2.0
Post by: CognosPaul on 28 Jul 2013 02:16:37 AM
Hi Or! It's been a long time!

The JavaScript API changed significantly from 8.2 to 10.2. As part of the migration, you'll need to start converting the JavaScript that touches the prompts and navigation.  As of 10.2 you can do something like this:

cognos.Report.getReport('_THIS_').sendRequest(cognos.Report.Action.NEXT);

or

<script>
  var oCR = cognos.Report.getReport('_THIS_');

function doNavigation(action){
  eval('oCR.Report.Action.'+action);
}
</script>

<input type="button" onclick="doNavigation('NEXT')" value="next"/>


If I remember, the way it's set up is like this:

Prompt Pages
1. Hidden to dynamically set prompts
2. Visible to allow users to select specific prompts

Report Pages
1. Whatever

Does clicking on the run button from inside the report send you to Prompt Page 1, which in turns just runs the report instead of doing next? Or does it not send you to any prompt page?
Title: Re: Customized-prompt page based on DB values in Cognos 10.2.0
Post by: ordotan on 28 Jul 2013 03:19:23 AM
Hi Paul,

I have tried replacing "promptButtonNext()" with "cognos.Report.getReport('_THIS_').sendRequest(cognos.Report.Action.NEXT)",
but the same thing happens -
When running the report for the first time, the hidden prompt-page redirects to the second prompt-page, and from there clicking finish takes me to the report page - Good!
But -
When re-running the report (using the "run" button) , the first hidden prompt-page appears, and then auto-redirects to the report page, instead of showing the second prompt page.

Title: Re: Customized-prompt page based on DB values in Cognos 10.2.0
Post by: ordotan on 28 Jul 2013 06:12:19 AM
Hi,
The correct way to use it was
<script>
setTimeout(function() {cognos.Report.getReport('_THIS_').sendRequest(cognos.Report.Action.NEXT);},200)
</script>

Thanks Paul !