COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: jmills on 16 May 2012 01:56:40 PM

Title: Why won't this condiitonal filter work?
Post by: jmills on 16 May 2012 01:56:40 PM
I am using Report Studio and am trying to implement this 'Simple' filter, however am getting an incomatible data types Error.   Anyone know how to revise this?

CASE [Earnings Code]
  WHEN 'H1001' Then ([Current Amount])
  ELSE ([Current Amount] <> 0)
END
Title: Re: Why won't this condiitonal filter work?
Post by: Gene on 16 May 2012 02:33:39 PM
Are you looking for "0" in the else clause?  Can't mix integers and strings.

Maybe you mean the following:

CASE [Earnings Code]
  WHEN 'H1001'  Then ([Current Amount])
  ELSE (0)
END

You need to express what exactly you want the result to be under which condition and then write the when/else expression accordingly.
Title: Re: Why won't this condiitonal filter work?
Post by: jmills on 16 May 2012 02:38:43 PM
I have a list where the user would like to see all values in [Current Amount]when the Earnings Code = 'H1001', and for the remainder of the list, filter out zero amounts.
Title: Re: Why won't this condiitonal filter work?
Post by: Lynn on 16 May 2012 03:06:37 PM
You should write filter conditions as boolean expressions so you get a true or false result for each row....think of your filter expression as part of a "where" clause in SQL.

If I understood your requirement correctly, maybe this might be what you want.


[Earnings Code] = 'H1001'
or
( [Earnings Code] <> 'H1001' and [Current Amount] <> 0 )


Title: Re: Why won't this condiitonal filter work?
Post by: jmills on 16 May 2012 03:39:04 PM
I think that may just do it!

thanks Lynn.  :)