COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: johny.cbi on 04 Feb 2008 02:47:10 PM

Title: value prompt
Post by: johny.cbi on 04 Feb 2008 02:47:10 PM
In a report I've value prompt  (YTD, QTD, MTD)

when I run the report it has to display automatically YTD

please share your ideas
Title: Re: value prompt
Post by: Suraj on 04 Feb 2008 03:06:15 PM
Use a html item and javascript to auto select the prompt values.
<script language = "javascript">
document.forms["formWarpRequest"].elements["_oLstChoices<fieldname>"].selectedIndex = 2;
</script>
Where <fieldname> is the name of the prompt under properties, name.

Check cognos document:
http://support.cognos.com/knowledgebase/googlesearch?load_kb_document=1&dr=kb1&uniqueid=114497
Title: Re: value prompt
Post by: rockytopmark on 04 Feb 2008 04:16:34 PM
This code is valid in 8.2 and earlier but apparently not in 8.3... does anyone have updated syntax for 8.3??
Title: Re: value prompt
Post by: Suraj on 05 Feb 2008 09:27:58 AM
That's interesting...
So it doesn't work in 8.3?
We don't have 8.3 yet, so no help here...
Title: Re: value prompt
Post by: johny.cbi on 05 Feb 2008 01:35:18 PM

Thanks for the reply
Title: Re: value prompt
Post by: rockytopmark on 06 Feb 2008 05:05:04 PM
I got this to work in 8.3...


document.formWarpRequest._oLstChoicesPromptControlName.options[2].selected =  true


... which selects the first value row (Row 3) in the list (row 1 is the item name and the row 2 is dashes)

I believe once the control is used, its name gets changed to some random value, making the code good only on initial render.