COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: kado on 20 Jun 2012 11:05:15 PM

Title: Set and Select Value Prompts default value Dynamically
Post by: kado on 20 Jun 2012 11:05:15 PM
Hello Cognoise -

Has anyone ever used some Java to default a value prompt dynamically based on a value from a query? Or in other words ... Is there anyway to set and select a value prompt without placing a value in the 'Default' property of the Value Prompt (since you can only hard-code a value here)?

THANKS!
Title: Re: Set and Select Value Prompts default value Dynamically
Post by: kado on 21 Jun 2012 05:03:31 PM
I found a potential solution out on the ITtoolbox for Cognos 8 but I can't get it to work with Cognos 10 ... nothing happens. Anybody with some Java skills help me out?

THANKS



Try these (If the type of prompt) is drop down:

1) Sort the dates such that they appear in descending order.
2) In the properties of the value prompt, under Miscellaneous section, specify a value for the name property.(Here it is 'Prompt')
3)Drag and drop an HTML object from Toolbox tab to the prompt page after the value prompt.
4) Put in the following javascript so that the first date appears as a default date in the prompt:

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

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

canSubmitPrompt();
</script>