Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Talend If in Tmap

Hello, 

I have condition where doing insert in Salesforce.

If field1= 'CHQ' then FinalDate = date1

else if field1 = 'CB' then FinalDate = Date2 

 

In Salesforce, field is null

Can SomeOne Help me.

Labels (3)
1 Solution

Accepted Solutions
ThWabi
Creator II
Creator II

Hello aichas,

 

your code in the attached GIF is almost correct. Please do not use "==" for comparing strings, use the .equals() method.

((row4.TypeCoupon.equals("CHQ") ? row4.DateCheque : row4.DateDignature))

For your example given in the text, you can nest such ternary statements. The formula for "FinalDate" could be

field1.equals("CHQ") ? date1 : field1.equals("CB") ? Date2 : date3

"date3" is the value for "FinalDate" if field1 is not equal to "CHQ" or "CB".

 

Best regards,

 

Thomas

 

View solution in original post

2 Replies
ThWabi
Creator II
Creator II

Hello aichas,

 

your code in the attached GIF is almost correct. Please do not use "==" for comparing strings, use the .equals() method.

((row4.TypeCoupon.equals("CHQ") ? row4.DateCheque : row4.DateDignature))

For your example given in the text, you can nest such ternary statements. The formula for "FinalDate" could be

field1.equals("CHQ") ? date1 : field1.equals("CB") ? Date2 : date3

"date3" is the value for "FinalDate" if field1 is not equal to "CHQ" or "CB".

 

Best regards,

 

Thomas

 

lennelei
Creator III
Creator III

Hi,
just a small tip. Instead of using this:

field1.equals("CHQ")

use that:

"CHQ".equals(field1)

And you won't have NullPointerException anymore when field1 is null 0683p000009MA9p.png

Regards