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

Six Stars

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

 
Four Stars act
Four Stars

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

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?

Six Stars

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

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?


 

Four Stars act
Four Stars

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

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

 

 

 

 

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.