COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Fulvio on 20 Mar 2009 09:02:09 AM

Title: Filter data with the prompt pre-selected
Post by: Fulvio on 20 Mar 2009 09:02:09 AM
Hello,

i would display dynamically first item in a value prompt and to reflect that item.
I used following java script :

            <script language="JavaScript">
                 function setDefaultValue()
                 {
                      var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
                      if (fW)
                      {
                           fW._oLstChoicesPrompt1.options[0].text = 'Bikes';
                           fW._oLstChoicesPrompt1.focus();
                           fW._oLstChoicesPrompt1.blur();
                       }
                 }
                 setTimeout("setDefaultValue()", 10);
           </script>



With this i am able to display the value in the prompt as indicated in the script
but are unable to view the filtered data for that value.

Can you help me?
Title: Re: Filter data with the prompt pre-selected
Post by: Fulvio on 23 Mar 2009 05:03:39 AM
Hi,

There is nobody that can answer to me ?
Title: Re: Filter data with the prompt pre-selected
Post by: Sunchaser on 23 Mar 2009 05:52:39 AM
Hi,

If the datas that should be filtered are linked to the value-prompt like a "cascading source", you should try in your javascript a code to do a "reprompt" of the page after you put the value in the value-prompt.

I don't have the code here for the moment (and I don't remember correctly, maybe it's like "setPromptAction(...)"), but I think you can find it.
Title: Re: Filter data with the prompt pre-selected
Post by: Fulvio on 23 Mar 2009 08:13:21 AM
Thanks
Title: Re: Filter data with the prompt pre-selected
Post by: Sunchaser on 23 Mar 2009 09:01:45 AM
Hi,

Try something like:

setPromptControl('reprompt');
Title: Re: Filter data with the prompt pre-selected
Post by: Fulvio on 24 Mar 2009 07:03:21 AM
Hi,

Should I put a button prompt?
Title: Re: Filter data with the prompt pre-selected
Post by: Sunchaser on 24 Mar 2009 11:05:21 AM
Hi,

No, I didn't mean that.
I'm nearly sure that it's possible to call the same behaviour as a reprompt button with something like:
"javascript:setPromptControl('reprompt');"
in a code.

I can't really test again, as one of my PC used for personnal testing has "crashed down", and I'm in a real nightmare now...

Title: Re: Filter data with the prompt pre-selected
Post by: Fulvio on 25 Mar 2009 09:27:03 AM
Hi

I proved to add

setPromptControl('reprompt'); after
setTimeout("setDefaultValue()", 10); statement

and give me these errors:

Error: Object Expected
Error: Unable to move the focus to control because no visible, enabled or of a type that can not be made active.