COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: hespora on 08 May 2017 08:42:47 AM

Title: Checking an optional prompt without making it required
Post by: hespora on 08 May 2017 08:42:47 AM
Hi there,


I have a report with two optional prompts, filtering Query1 on FieldA and FieldB. In my query, I need to detect which prompt has been used by the user, as different calculation depend on that. How do I actually do that without making the prompts required? Using ParamCount, ParamValue, or even "if (?promptA? is null)" all turn the prompt into required rather than optional.
Title: Re: Checking an optional prompt without making it required
Post by: bdbits on 08 May 2017 11:17:45 AM
Have you tried a prompt macro? Most of the time they are evaluated at runtime, so that may keep the prompt optional.
Title: Re: Checking an optional prompt without making it required
Post by: hespora on 09 May 2017 02:46:25 AM
I did, but I (actually! :D) had an idea in the shower about that this morning about what I might have done wrong - turns out that #prompt('promptA','token','')# makes a prompt required, wheras #prompt('promptA','token','defaultvalue')# does not. When I checked y-day I only checked with an empty default value (I figured an empty string is still a value; guess Cognos thinks otherwise).

Learning something new every day... :D Thanks for your help!
Title: Re: Checking an optional prompt without making it required
Post by: sdf on 15 May 2017 01:44:25 AM
i wonder if a space can make a difference or cognos will treat the same.  :o
#prompt('promptA','token',' ')#