Help with IF/Else statement

Highlighted
Six Stars

Help with IF/Else statement

Hello

I'm trying to get help on this if/else statement.  I don't really know what I'm doing when I need to include more than one condition.  This is my statement

row8.Code.equals("AE") ? null :
row5.CONTACT_ADD3 :
row5.CONTACT_ADD3.equals(null)?
row5.CONTACT_POSTCODE :
row5.CONTACT_ADD3+", "+row5.CONTACT_POSTCODE

So I'm trying to say

If Code = AE then make the field null, else

Use contact_add3, else

If contact_add3 is null then use contact_postcode, else

use contact_add3 + contact_postcode

 

I'm getting the error in the screenshot.  Thank you so much for help.

 


Accepted Solutions
Highlighted
Sixteen Stars
Sixteen Stars

Re: Help with IF/Else statement

row8.Code.equals("AE") ? null :
row5.CONTACT_ADD3 == null ?
row5.CONTACT_POSTCODE :
row5.CONTACT_ADD3 + ", " + row5.CONTACT_POSTCODE

TRF

View solution in original post


All Replies
Highlighted
Sixteen Stars
Sixteen Stars

Re: Help with IF/Else statement

row8.Code.equals("AE") ? null :
row5.CONTACT_ADD3 == null ?
row5.CONTACT_POSTCODE :
row5.CONTACT_ADD3 + ", " + row5.CONTACT_POSTCODE

TRF

View solution in original post

Highlighted
Six Stars

Re: Help with IF/Else statement

Use this it will work

 

row8.Code.equals("AE") ? null :
Relational.ISNULL(row5.CONTACT_ADD3) ? row5.CONTACT_POSTCODE : row5.CONTACT_ADD3 + ", " + row5.CONTACT_POSTCODE

Highlighted
Sixteen Stars
Sixteen Stars

Re: Help with IF/Else statement

Did this help? If so, thanks to mark your case as solved (Kudo also accepted)

TRF
Highlighted
Six Stars

Re: Help with IF/Else statement

Got that working now - thank you both!

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog