COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: inu on 04 Oct 2016 07:30:57 AM

Title: How to reset the prompt values using javascript
Post by: inu on 04 Oct 2016 07:30:57 AM
Hi Team,

Can you please refer me js code to reset the prompt values as in my report several prompts are there.


Regards,
Inam
Title: Re: How to reset the prompt values using javascript
Post by: FabianGaussling on 04 Oct 2016 07:39:32 AM
Hi,

Cognos offers in the 10.2.x Version the so called prompt api. That is a set of functions to manipulate and validate prompt values. You can use These functions to set up your prompts in your reports.

In my blog you find a tutorial on the prompt api: http://bi-solutions.gaussling.com/cognos-javascript-part-iii-prompt-api/

I hope that helps you...

BR
Fabian
Title: Re: How to reset the prompt values using javascript
Post by: inu on 04 Oct 2016 09:02:41 AM
Quote from: FabianGaussling on 04 Oct 2016 07:39:32 AM
Hi,

Cognos offers in the 10.2.x Version the so called prompt api. That is a set of functions to manipulate and validate prompt values. You can use These functions to set up your prompts in your reports.

In my blog you find a tutorial on the prompt api: http://bi-solutions.gaussling.com/cognos-javascript-part-iii-prompt-api/

I hope that helps you...

BR
Fabian

Thanx for your response...but this website is blocked here....
Title: Re: How to reset the prompt values using javascript
Post by: AnalyticsWithJay on 04 Oct 2016 09:49:05 AM
Here's a good solution for resetting values to their defaults when you have multiple prompts:
http://www.performanceg2.com/resetting-prompts-default-values-cognos/

If all you need is to just clear the values, you can use the following script:


function clearAllValues() {
var oCR = cognos.Report.getReport("_THIS_");
var aControls = oCR.prompt.getControls();
for (var i = 0; i < aControls.length; i++) {
aControls[i].clearValues();
}
}
Title: Re: How to reset the prompt values using javascript
Post by: inu on 04 Oct 2016 10:02:20 AM
Quote from: CognoidJay on 04 Oct 2016 09:49:05 AM
Here's a good solution for resetting values to their defaults when you have multiple prompts:
http://www.performanceg2.com/resetting-prompts-default-values-cognos/

If all you need is to just clear the values, you can use the following script:


function clearAllValues() {
var oCR = cognos.Report.getReport("_THIS_");
var aControls = oCR.prompt.getControls();
for (var i = 0; i < aControls.length; i++) {
aControls[i].clearValues();
}
}


Thanks all of you... solved
Title: Re: How to reset the prompt values using javascript
Post by: inu on 05 Oct 2016 02:10:42 AM
Quote from: inu on 04 Oct 2016 10:02:20 AM
Thanks all of you... solved


Thanks a lot CognoidJay, its almost done ... but clearing values didnot resolve the issue... for default prompt values i went through the link, but i could not accomplish the task.. can you please modify the code and send that to me for my convenience.


Regards,
Inam