Help me with the logic for TMAP Please

Highlighted
Six Stars

Help me with the logic for TMAP Please

Hello All,

Can you please help me how to achieve the below scenario.I need to write the condition in TMAP.

 

If Column A =1 and rest of columns B,C,D are 0, then target column should be populated with 'Applicant'.

If Column A and B =1 and rest of columns C,D are 0, then target column should be populated with 'Admit'.

If Column A and B and C =1 and rest of column D IS 0, then target column should be populated with 'Commit'.

If all columns A,B,C,D are = 1, the the target column should be populated with 'Net Commit'.

 

Thanks


Accepted Solutions
Six Stars

Re: Help me with the logic for TMAP Please

I am assuming A,B,C,D as input column and there is only one output column, which can have the given values, so you can use if condition to assign values to the output column as per the condition and assign null if non match, like below

(input_row.A==1)&&(input_row.B==0)&&(input_row.C==0)&&(input_row.D==0)?"Applicant":

(input_row.A==1)&&(input_row.B==1)&&(input_row.C==0)&&(input_row.D==0)?"Admit":

(input_row.A==1)&&(input_row.B==1)&&(input_row.C==1)&&(input_row.D==0)?"Commit":

(input_row.A==1)&&(input_row.B==1)&&(input_row.C==1)&&(input_row.D==1)?"NetCommit":null


All Replies
Six Stars

Re: Help me with the logic for TMAP Please

I am assuming A,B,C,D as input column and there is only one output column, which can have the given values, so you can use if condition to assign values to the output column as per the condition and assign null if non match, like below

(input_row.A==1)&&(input_row.B==0)&&(input_row.C==0)&&(input_row.D==0)?"Applicant":

(input_row.A==1)&&(input_row.B==1)&&(input_row.C==0)&&(input_row.D==0)?"Admit":

(input_row.A==1)&&(input_row.B==1)&&(input_row.C==1)&&(input_row.D==0)?"Commit":

(input_row.A==1)&&(input_row.B==1)&&(input_row.C==1)&&(input_row.D==1)?"NetCommit":null

Six Stars

Re: Help me with the logic for TMAP Please

Thank you so much. I just implemented this logic and I was able to achieve my requirement. And yes the target column is only one column.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog