Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to perform below CASE statement in Talend

Hi Team,

 

We need to implement below CASE statement in Talend. Please suggest the design for the same.

 

CASE WHEN WTR IS NULL AND BNP IS NULL THEN 'MOP'
WHEN WTR = 0 AND BNP = 0 THEN 'MOP'
WHEN WTR > 0 AND BNP < 0 THEN 'WNT'
WHEN WTR < 0 AND BNP > 0 THEN 'BNP'
WHEN WTR < 0 AND BNP < 0 THEN 'MOP'
WHEN (WTR IS NULL OR WTR = 0) AND BNP <= 0 THEN 'MOP'
WHEN (BNP IS NULL OR BNP = 0) AND WTR <= 0 THEN 'MOP'
WHEN (WTR IS NULL OR WTR = 0) AND BNP > 0 THEN 'BNP'
WHEN (BNP IS NULL OR BNP = 0) AND WTR > 0 THEN 'WNT'
WHEN DECIMAL(WTR,17,5) / NULLIF(BNP,0) <= 0.4 AND DECIMAL(WTR,17,5) / NULLIF(BNP,0) > 0 THEN 'BNP'
WHEN DECIMAL(WTR,17,5) / NULLIF(BNP,0) > 0.4 AND DECIMAL(WTR,17,5) / NULLIF(BNP,0) < 1.6 THEN 'MOP'
WHEN DECIMAL(WTR,17,5) / NULLIF(BNP,0) >= 1.6 THEN 'WNT'

END AS TYPE

 

We are using TOS.

Labels (2)
2 Replies
TRF
Champion II
Champion II

As the expression is a little bit complicated, I suggest you to use a tJavaRow instead of ternary expression within a tMap component. This you can use regular "if-then-else" notation which may help for readability.

Anonymous
Not applicable
Author

Thanks for your reply.

Can you please provide some example or link where I can read through this approach.