Multiple if-else in Expression Field of a column in tmap

Eight Stars

Multiple if-else in Expression Field of a column in tmap

Hi All,
Hope everyone is doing well. 😊
I have a scenario where I have to derive error_code in error_code column of tmap. Value will be like 1,2,3
Scenario is like
Condition1==false?"2":Condition2==null?"1":Column3 less than -1 or column 4 less than -1?"3":"".
I have tested upto "1" which is working fine. Bad data going to Error Table and giving proper Error Code. Can I write multiple If after "1"?
@vboppudi, @rhall_2_0, @TRF

Accepted Solutions
Nine Stars

Re: Multiple if-else in Expression Field of a column in tmap

I think you can write if condition. Are you getting any error?

 

Regards.

Veeru Boppudi
Community Manager

Re: Multiple if-else in Expression Field of a column in tmap

It looks like you have kind of the right idea from your pseudo code, can elaborate on what the issue is?

Forteen Stars

Re: Multiple if-else in Expression Field of a column in tmap

@abhi90,yes you can use nested if condition in tMap.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

All Replies
Nine Stars

Re: Multiple if-else in Expression Field of a column in tmap

I think you can write if condition. Are you getting any error?

 

Regards.

Veeru Boppudi
Community Manager

Re: Multiple if-else in Expression Field of a column in tmap

It looks like you have kind of the right idea from your pseudo code, can elaborate on what the issue is?

Forteen Stars

Re: Multiple if-else in Expression Field of a column in tmap

@abhi90,yes you can use nested if condition in tMap.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Eight Stars

Re: Multiple if-else in Expression Field of a column in tmap

Yes it's Possible.Thanks for all of your suggestions again Smiley Happy .Marking this Port as resolved. Did below

(Var.v_FLG==false?"2":
row1.ACCOUNT_NAME==null?"1":
Double.parseDouble(row1.column1)<=-1D || Double.parseDouble(row1.column2)<=-0.001 || Integer.parseInt(row1.column3)<=-1 || Integer.parseInt(row1.column4)<=-1 || Integer.parseInt(row1.column5)<=-1 || Integer.parseInt(row1.column6)<=-1 || Integer.parseInt(row1.column7)<=-1 || Integer.parseInt(row1.column8)<=-1 || Integer.parseInt(row1.column9)<=-1 || Integer.parseInt(row1.column10)<=-1 || Integer.parseInt(row1.column11)<=-1 || Integer.parseInt(row1.column12)<=-1?"3":"10")

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

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

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads