COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Greg on 20 Sep 2013 01:44:04 PM

Title: report variable to check whether optional prompt specified
Post by: Greg on 20 Sep 2013 01:44:04 PM
In my report I have an optional prompt and filter on Sales Rep.  I need to create a conditional block where if a sales rep is selected it will just show the sales rep name and if none is selected then it will show a drop down list of sales reps.  In order to do this I need a report variable that indicates whether a sales rep was selected.  So it seems that I need a query with a data item for the sales rep parameter, but if I define it like #prompt( 'pSalesRep', 'string', '' )# with an empty default value then the sales rep prompt becomes mandatory.  So how can I create a variable that will indicate whether a sales rep was selected for this optional prompt?  Thanks.
Title: Re: report variable to check whether optional prompt specified
Post by: calson33 on 20 Sep 2013 01:52:34 PM
Try using this instead:
#prompt( 'pSalesRep', 'string', 'NONE' )#

and check for 'NONE' instead of an empty string.
Title: Re: report variable to check whether optional prompt specified
Post by: Greg on 20 Sep 2013 01:55:03 PM
But if I put 'NONE' as the default value then won't my filters by defalt filter for the value 'NONE'?
Title: Re: report variable to check whether optional prompt specified
Post by: Greg on 20 Sep 2013 02:01:07 PM
I just tried your suggestion and it works great.  Thanks!
Title: Re: report variable to check whether optional prompt specified
Post by: calson33 on 20 Sep 2013 02:10:31 PM
had to go check a few things...

I might be over complicating it.

If you set up a boolean condition on whether your prompt is null or not - ParamValue('sales_rep') is null
and then set your conditional block to show your drop down when it is null (Yes) and hide it when it is not null (No).

No SQL involved.