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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
AAA999
Contributor III
Contributor III

How can you compare integer columns from same table in Talend data integration components

 
Labels (2)
3 Replies
act
Contributor
Contributor

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?

AAA999
Contributor III
Contributor III
Author

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?


 

act
Contributor
Contributor

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