cancel
Showing results for 
Search instead for 
Did you mean: 

Case statement in filter condition not working IDT SAP 4.1 sp3

Former Member
0 Kudos

Hi guys

I need to have a case statement for a new filter I need to have in blx as below:

case when (fact_table.event_key in (4,5)) then 'Current' else 'old'

I get an error message saying 'the where clause result type is not boolean'

any idea why?

cheers

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You  missed the End Key word at the end of script please use below..

case when (fact_table.event_key in (4,5)) then 'Current' else 'old' end


Like e.g. CASE WHEN "EMPLOYEE"."SAL" IN(100,200) Then 500 ELSE 200 END

Regards

Niraj

Former Member
0 Kudos

I tried that but still getting the error  saying:

'type VARCHAR and BIT are not compatible with operator AND

Former Member
0 Kudos

Hi ,

Could you please send us the exact code that you have in there also make sure you are using same data type in both Then and Else part.

Regards

Niraj

Former Member
0 Kudos

case when(fact_sales.sales_key in (51,43)) then 'P' else 'C' end

amitrathi239
Active Contributor
0 Kudos

Try this.

CASE

WHEN

@Select(Class\Object) IN (51,43)

THEN

'P'

ELSE

'C'

END

Former Member
0 Kudos

Still getting an error:

type 'VARCHAR' and 'VARCHAR' not compatible with operator 'AND'

amitrathi239
Active Contributor
0 Kudos

what is the datatype of your key object?think so string.

use single quotes for key values.like ('51','43')