how to use nested if condition in tmap

One Star

how to use nested if condition in tmap

I have one decode. I want to convert it into if-else condition of talend in tmap
decode(v_DURATION,'PERPETUAL',NULL,NULL,NULL,'Duration:' ||v_DURATION)


Thanks in advance,
Kiran.
Four Stars

Re: how to use nested if condition in tmap

Kiran - let me give this a stab... In plain English, here's what your statement translates to:
if v_DURATION = PERPETUAL then Null
else if v_DURATION = Null then Null
else 'Duration:' ||v_DURATION
Using ternary operators in tMap, the standard is "test condtion ? true : false"
row1.v_DURATION !=null && !row1.v_DURATION.isEmpty() ? (row1.v_DURATION.equals("PERPETUAL")? null : row1.v_DURATION.equals("NULL")? NULL : "Duration: " + row1.v_DURATION) : ""
To avoid the pervasive nullpointer exception, I first check to make sure v_Duration has a non-Null value...
One Star

Re: how to use nested if condition in tmap

thanx willm

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

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

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now