COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Ann on 16 May 2011 08:24:52 AM

Title: Javascript code for reseting a parameter
Post by: Ann on 16 May 2011 08:24:52 AM
Can someone help me by providing the javascript code for reseting a parameter?

The actuals requirement is as follows:

I have a prompt for Area(prompt page1) and location(prompt page2) in my report. I have assigned Area parameter(p_area) as the cascading source for location prompt. Now each time i rerun the report, and then if i select my value selected in Area Prompt, then go to second prompt page, i see that the finish button is already enabled. Now what is the user does is , he hits a finish button without sleecting the new location(with respect to new area selected). There by the report retuns the same old data.(As the report query has filter for location prompt)
Title: Re: Javascript code for reseting a parameter
Post by: CognosPaul on 16 May 2011 08:45:24 AM
Place an HTML item into the first page with the following expression:

<input type="hidden" name="p_Location" value="">

When the user reruns the prompt page Cognos should fill the Location parameter with the value="", essentially nulling the param. Make sure that the "p_" is before the parameter name, so if your parameter is pLocation it should be p_pLocation.

You could also put this in the body of the report, but it won't be triggered if the user views the report in PDF or Excel (or any other non HTML format).
Title: Re: Javascript code for reseting a parameter
Post by: Ann on 16 May 2011 09:31:49 AM
It worked  :)

Thanks a Lot!!
Title: Re: Javascript code for reseting a parameter
Post by: Cognos Bee on 13 Feb 2015 02:49:47 PM
Is there anyway to make this easy solution in C10.2.1

I need to clear a Text Box Prompt when user re-runs the report.

Many thanks