COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: perspolis09 on 25 Jul 2013 02:48:02 PM

Title: Filter error
Post by: perspolis09 on 25 Jul 2013 02:48:02 PM
Hi,

if event_code in (sag, sur) and phase is null then "puuttuu" else phase

why do I get error, What should change the filter?

Title: Re: Filter error
Post by: BigChris on 25 Jul 2013 03:49:11 PM
You can't have an if...then...else statment in a filter. You're statement isn't very clear...what are you comparing to "puuttuu" or phase?
Title: Re: Filter error
Post by: MFGF on 26 Jul 2013 03:09:09 AM
Quote from: perspolis09 on 25 Jul 2013 02:48:02 PM
Hi,

if event_code in (sag, sur) and phase is null then "puuttuu" else phase

why do I get error, What should change the filter?

This looks very much like the expression to return a value for a calculation. Is that your intent?  Expressions for filters need to return a result which is true or false (so that each row is either included in or excluded from the query result set).

eg

if ([event_code] in ('sag', 'sur') and [phase] is null) then ([another column] = 'puuttuu') else ([another column] = [phase])

My expression will return one of two possible results to the filter - either

[another column] = 'puuttuu'

or

[another column] = [phase]

Both of these are expressions which will either evaluate to TRUE or FALSE when evaluated at runtime

Cheers!

MF.
Title: Re: Filter error
Post by: perspolis09 on 27 Jul 2013 04:05:48 PM
thanks this help me a lot! :)