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

Dynamically populate a dropdown with a value

Started by Sideout72, 15 Apr 2009 06:55:04 PM

Previous topic - Next topic

Sideout72

I've read all the Cognos 8.3 docs, and I can't figure out why this doesn't work.  I've got a report with no prompt screen.  That report has a required prompt for the report.  The prompt is a dropdown, which autosubmits.

The following code does work to populate the prompt (called Month) with the third item in the list, and executes the report.  However, it will execute the report twice - once for the "default" value, and again for the reset value, since it isn't setting the dropdown before executing the report:

<script type="text/javascript">
function myinit()
{
   var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
   fW._oLstChoicesMonth.options[3].selected = true;
   promptButtonFinish();
}
myinit();
</script>

However, the following code SHOULD work, based on all the KB articles and everything I've seen out there, but it doesn't:

<script type="text/javascript">
function myinit()
{
   var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
   fW._oLstChoicesMonth.options[10].selected = true;
   promptButtonFinish();
}
</script>
<body onLoad=myinit()>

Can anyone explain why?  The body onLoad function never gets called, and it never executes the myinit() function at all.

Any insight you can provide would be greatly appreciated.

Ycheneo

               What you think it will needs to updates?


________________
How Can

Gopinath

Try palcing the following script next to your prompt.

<script type="text/javascript">
{
   var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
   fW._oLstChoicesMonth.selectedIndex = 3;
   promptButtonFinish();
}
</script>

jimpats

Hi,
I have a similar issue and problem.
I do not have a submit or next button. This report is used as a performance chart in a dashboard and i need it to default to max value dynamically and then allow the user to change the values in drop down as it is auto submit. It allows the user to change. But when it loads initially, it uses the default values rather than the value from the java script as per logic. It does show the value but is not submitting it.

<script language="javascript">
var f = getFormWarpRequest();
var list = f._oLstChoicesSnapshotEventWeek;
list.remove(1);
list.remove(0);
list.removeAttribute("hasLabel");
//f._oLstChoicesSnapshotEventWeek[0].selected=true;
f._oLstChoicesSnapshotEventWeek.selectedIndex = 0;
promptButtonFinish();
</script>

After displaying the default value chart the page refreshes and gives me an error,
The secondary request failed. The requested session does not exist and the secondary request does not contain enough information to recreate the session. Contact your Administrator.

Please help.