COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: pking on 28 Nov 2007 08:38:28 AM

Title: Javascript to set the User Value and Display Value of a value prompt
Post by: pking on 28 Nov 2007 08:38:28 AM
Currently we have a Javascript in an HTML item to refresh a Cognos Reportnet at specific intervals.

The script loads the parameter of ID, using code below.
-------------------------------------------------------------------------------------------------------------------
   <script type="text/javascript">

function init()
{
  for (i=0; i < document.formWarpRequest._oLstChoicespAction_prompt2.options.length; i++)
  {
    if
    (document.formWarpRequest._oLstChoicespAction_prompt2.options.text == '&p_p_ID')
   {
      document.formWarpRequest._oLstChoicespAction_prompt2.options.selected =  true;
      listBoxpAction_prompt2.checkData();
      break;
    }
  }
}
</script>
<body onLoad=init()>
[/i][/i]
-----------------------------------------------------------------------------------------------------------------------------
This is currently working correctly, but only when the value prompt in report studio has the Display Vlaue set to ID,  what is requied is that the Name of the ID be used.
The Value Prompt in Report Studio is set up as follows:

query:  IdPromptQuery
User Value :  ID
Display Value:  Name
Parameter: p_ID

Misc:
Name: Action_prompt2

Set like this nothing is returned on the report because Name is not populated.  When the Display Value is changed to ID it works properly, but the ID is displayed on the Report not the Name.

Is there some way in the javascript that the User Value be set, but return the Display value?