COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: nishithshri on 13 Mar 2017 01:31:12 PM

Title: Change of default selection of a prompt value based on another prompt value
Post by: nishithshri on 13 Mar 2017 01:31:12 PM
I am trying to set up a default selections based on another prompt value. For example: If a user select X value in prompt 1  then the prompt 1 should default it to 'abc'. Prompt 1 and prompt 2 are cascading prompt. I have been trying a few things but not luck so far !!

Any help or suggestions?
Title: Re: Change of default selection of a prompt value based on another prompt value
Post by: AnalyticsWithJay on 14 Mar 2017 08:51:39 AM
I have an article on selecting a default value dynamically:

http://www.cognoswithjay.com/selecting-a-dynamic-default-value-for-value-prompts-using-javascript/

Basically, we hide the value that needs to be selected on the page. Javascript will pickup that value, traverse the prompt you want to have selected, and select the matching value.

Have a read and let me know if you have any questions.
Title: Re: Change of default selection of a prompt value based on another prompt value
Post by: nishithshri on 15 Mar 2017 04:23:44 PM
I read the article. However, i am unable to find a JS that would work for multi select check box prompt.
Title: Re: Change of default selection of a prompt value based on another prompt value
Post by: AnalyticsWithJay on 16 Mar 2017 10:26:15 AM
Quote from: nishithshri on 15 Mar 2017 04:23:44 PM
I read the article. However, i am unable to find a JS that would work for multi select check box prompt.

If it's a single dynamic value the code should work the same, even for a checkbox. If it's a multiple dynamic value, you've piqued my interest... I may have to write a blog post about this.
Title: Re: Change of default selection of a prompt value based on another prompt value
Post by: AnalyticsWithJay on 16 Mar 2017 12:48:55 PM
Here's a sample:

http://www.cognoswithjay.com/selecting-multiple-prompt-values-dynamically-using-javascript/

Tested in Firefox.