Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi! An expression in a tMap could generally do, but there are many different ways in Talend to achieve a comparison between fields of a same table, depending on the action you want to take.
Can you describe what you need to do?
I didn't found any function where you can compare columns from same table.
Logic.
if (col A > col B and col A > col C then col A, if col B > col A and col B > col C then col B , col C).
how to achieve this in tmap?.
@act wrote:
Hi! An expression in a tMap could generally do, but there are many different ways in Talend to achieve a comparison between fields of a same table, depending on the action you want to take.
Can you describe what you need to do?
is it the the max value of col A, col B, col C you want?
you can do this with the function Math.max if you fields are integer.
if not you can use the ternary operator ? :
exp1 ? exp 2 : exp 3
will return exp 2 if expression exp 1 is true, exp 3 if not
in your case you would need two nested operations:
col A >= col B && col A >= col C ? col A :
col B >= col A && col B >= col C ? col B : col C