COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: hittony on 08 Apr 2014 10:14:12 AM

Title: [10.1.1] How to apply a condition to a filter ?
Post by: hittony on 08 Apr 2014 10:14:12 AM
Hey :)

Is it possible to apply a condition to a filter ?

I explain : if the condition si true, the filter should be required, otherwise it should be optional.

Thanks in advance for your help !

;)
Title: Re: [10.1.1] How to apply a condition to a filter ?
Post by: MFGF on 08 Apr 2014 12:13:00 PM
Hi,

Assuming your "condition" to drive this is (for example) [Field] = 100

the approach I would take is:

([FIELD] = 100 AND <current filter expression>) OR ([Field] <> 100 AND (<current filter expression> OR 1=1))

Cheers!

MF.
Title: Re: [10.1.1] How to apply a condition to a filter ?
Post by: hittony on 09 Apr 2014 02:54:04 AM
Quote from: MFGF on 08 Apr 2014 12:13:00 PM
Hi,

Assuming your "condition" to drive this is (for example) [Field] = 100

the approach I would take is:

([FIELD] = 100 AND <current filter expression>) OR ([Field] <> 100 AND (<current filter expression> OR 1=1))

Cheers!

MF.

I forgot to detail that the filter was linked to a parameter. With your approach, the report asks users to give a value in both 2 cases, which isn't what i want to carry out :(
Title: Re: [10.1.1] How to apply a condition to a filter ?
Post by: Lynn on 09 Apr 2014 07:32:30 AM
Try setting a default value for the parameter.