If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

hi experts in report studio dynamic prompt selection issue

Started by nagababu, 23 Aug 2012 12:24:01 PM

Previous topic - Next topic

nagababu

Ihave two value prompts on year.like from year and toyear with 10 years data on both prompts based on fromyear selection need to be select in second prompt.example if iselect 2011 in from year automatically default value 2011 need to be select in second prompt I.e,toyear

tjohnson3050

Cognos Report Studio does not give the ability to make a dynamic default prompt selection.

It can be done with javascript (some better at it than me may want to post).

What you can do is make a the first prompt filter the second prompt, so that choosing 2011 on the first prompt filters out 2010 and earlier years from the selection list in the second prompt.

CognosPaul

If I understand the requirements, you have two year value prompts. Both are based on the same query, both show the same set of years, one is fromYear and one is toYear.

You need to have the fromYear change whenever a different year in the toYear is selected?

Try this (may not working perfectly, doing it from memory):

First, name both prompts "_fromYear" and "_toYear".
Second, paste this into an HTML after the prompts:

<script>
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined) 
{

    fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );

}

fW._oLstChoices_toYear.onChange = new Function ("fW._oLstChoices_fromYear.selectedIndex = fW._oLstChoices_toYear.selectedIndex");
</script>


If my memory is correct (no guarantees, I don't have Cognos to check it at the moment), this will meet your needs as I understand them.

nagababu

Thanks for your replies.I tried with that java script.but its not working.

Is there any way Auto selection in the first value in the prompt.

Actually for the above senario,iam able to get selected values comes first in the second prompt.

but auto selection only the main problem,i have used cascade prompt fromyear and toyear

nagababu

thanks every one , i have achived the above required prompt selection by using below mentioned java script.

<script language="javascript">
var f = getFormWarpRequest();
var list = f._oLstChoicesPrompt1;

list.remove(1);
list.remove(0);
list.removeAttribute("hasLabel");
list.options[0].selected = true;

</script>