COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Cognosuser2019 on 05 Nov 2015 03:03:36 PM

Title: Making a prompt optional and required based on condition
Post by: Cognosuser2019 on 05 Nov 2015 03:03:36 PM
Hi All,

Is it possible to make the same prompt optional and required based on a condition?

I have a Type Prompt with the values Monthly and Fiscal Year. When Monthly is selected it should show Month prompt which is mandatory. When Fiscal year is selected Month prompt should be hidden. But since it is marked as required filter in query even when it is hidden for Fiscal year when finish button is clicked it pops up a window to enter value for month.....

I don't want that to happen....but when monthly is selected it should let user to select one value and not leave it optional....
Title: Re: Making a prompt optional and required based on condition
Post by: bdbits on 06 Nov 2015 03:57:27 PM
Out of the box, I cannot think of any way to do that. But if you are familiar with javascript and on 10.2 or later, I think this could be done using the Prompt API.

https://www-01.ibm.com/support/knowledgecenter/SSEP7J_10.2.2/com.ibm.swg.ba.cognos.ug_cr_rptstd.10.2.2.doc/c_prmpt_api_overview.html%23prompt_api_overview (https://www-01.ibm.com/support/knowledgecenter/SSEP7J_10.2.2/com.ibm.swg.ba.cognos.ug_cr_rptstd.10.2.2.doc/c_prmpt_api_overview.html%23prompt_api_overview)

You need some javascript experience, and docs are not great but an experienced javascript developer should be able to figure it out. It's a bit too complicated to go into here as there are too many situation-specific parameters on how to get it working.