CASE END SQL STATEMENT

One Star

CASE END SQL STATEMENT

Hi all,
I have the following SQL expression i would like to use in TMAP and seem to be having a little bit of trouble.
Case
When a.CT = c.Cusip THEN 'C'
When a.CF = c.Cusip THEN 'D'
End ACTIONCODE
C or D can be the output for the same field (ACTIONCODE) when either one of those conditions is met.
Does anyone have any pointers on how I can accomplish this in Talend?
Any help would be greatly appreciated!
-Chris
Community Manager

Re: CASE END SQL STATEMENT

Hello
Does anyone have any pointers on how I can accomplish this in Talend?

Assuming your job looks like;
tMysqlInput---row1-->tMap--tLogRow
type in the expression of ACTIONCODE as:
If the data type of row1.CT, row1.Cusip, row1.CF is String, try
row1.CT.equals(row1.Cusip)?'C':(row1.CF.equals(row1.Cusip)?'D':other Value or null)

If the data type of row1.CT, row1.Cusip, row1.CF is Integer/int, try
row1.CT==row1.Cusip)?'C':(row1.CF==row1.Cusip?'D':other Value or null)

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business