COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: annoyed on 28 Aug 2009 03:43:25 PM

Title: IF Statement in Report Studio filter
Post by: annoyed on 28 Aug 2009 03:43:25 PM
Hello,

I am trying to filter out values similar to a prompt within the 'filter' section of a report studio query.  I have also tried adding this as a data item w/i the query, no luck.

I'd appreciate any input...

Here's an example of my statement:

IF (Country Code] = 'ABC') THEN (Currency Code = 'DEF' )

ELSE
(

IF (Country Code] = 'GHI') THEN (Currency Code = 'JKL' )
ELSE
      (
         IF (Country Code] IN ('MNO','PQR','STU')) THEN (Currency Code = 'VWX' )
         ELSE (NULL)
))


thanks
Title: Re: IF Statement in Report Studio filter
Post by: DustPanMan on 28 Aug 2009 10:28:32 PM
Since you are always looking at CountryCode, it is best to use Case... When logic.

Case ([CountryCode])
When 'abc' Then 'def'
When 'ghi' Then 'jkl'
Else 'mno'
End

Let me know if this works.
Title: Re: IF Statement in Report Studio filter
Post by: billylodz on 31 Aug 2009 05:18:49 AM
create new Item with this case or if, and this Item use in filter