COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Enrique on 15 Apr 2016 04:52:45 AM

Title: set Default parameter to null
Post by: Enrique on 15 Apr 2016 04:52:45 AM
Hi does enyone know how  to set a default Parameter to null

Right now when i dont click in my prompt Page i recive all the values 

I would like to do that when i dont click in my prom Page  (in wich one my paramter is associate ) set my parameter to null ,

its that posible?

thanks in advance , Enrique
Title: Re: set Default parameter to null
Post by: Ricardo Julio "Ricky" Villa on 15 Apr 2016 04:59:03 AM
Think to do this the query filter will need to be compulsory, which means the prompt will also need to be compulsory.

Which means you will need a default value in the prompt such as "Missing".  Then a conditional statement in the filter like:

if ( ?YourParameterName? = 'Missing' )
then ( [YourDataItemName] is null )
else ( [YourDataItemName] = ?YourParameterName? )
Title: Re: set Default parameter to null
Post by: Enrique on 15 Apr 2016 07:09:18 AM
Hi Ricardo , thanks for answer

I see a problem there,  in my promp page i can not have any other value , If i have good understand your answer,  with your solution the word "Missing" wold be appear  in the prompt page, doesnt it?

And i need that the prompt page keep in the original format  and nothing extra appear.
Title: Re: set Default parameter to null
Post by: Ricardo Julio "Ricky" Villa on 15 Apr 2016 08:54:03 AM
OK... how about this:

Create 2 Queries: Query A and Query B
Create 2 lists (assuming your report is a list report): List A and List B

Query A populates List A
Query B populates List B

Query A has this optional filter: [YourDataItemName] = ?YourParameterName? ( or change "=" to "in" if multiselect prompt)
Query B has this compulsory filter: [YourDataItemName] is null

Create 2 Boolean variables:
Variable A = ParamValue('YourParameterName') is not null
Variable B = ParamValue('YourParameterName') is null

Add Variable A as the Render Variable to List A
Add Variable B as the Render Variable to List B

That should do it...

Ricky

COYS



Title: Re: set Default parameter to null
Post by: Ricardo Julio "Ricky" Villa on 15 Apr 2016 08:54:41 AM
Your prompt must be set to optional too...