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

Set Default Selection Of a Value Prompt using Java Script

Started by gaurav2289, 18 Aug 2010 02:32:00 AM

Previous topic - Next topic

gaurav2289

Hi,

I want to set the default selection of a value prompt to a value which is result of a query. The result of query changes according to the Logged in user.

Would anybody provide me the required Java Script or Any other method to accomplish this task.

Thanks in Advance.

gaurav2289

Hi All,

I tried this -- I added another value prompt (hidden) and that prompt pulls the value which I want to select in the first value prompt. Code for this is --

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

var prompt = f._oLstChoicesMyPrompt1;

var prompt2=f._oLstChoicesMyPrompt;
prompt2.remove(1);
prompt2.remove(0);

if ( prompt2 && prompt2.options.length>2)
{


      var j=0;
      for(j=0;i<prompt2.options.length;j++)
          {
               
      if(prompt2.options[j].value==prompt.options[2].value)
                        {
                       
            prompt2.options.selectedIndex=j;
            prompt2.removeAttribute("hasLabel");
            canSubmitPrompt();
            break;
                       
                       }
          }
}
</script>


However my aim was only to set the default value but this always displays the same value in the prompt. Even if I run the report for some diffrent value, though the data displyed is filtered according the selected value but the value shown in the prompt remains same.
Can anyone suggest any solution for it?