How to use If and Set in Talend

Six Stars

How to use If and Set in Talend

Hi Folks,

 

I am new to Talend.

 

I am looking for functionality to execute the workflow.

Here is what I need,

If my input variable 1 is 'Usage' and my input variable 2 is blank then I want to set Input variable 2 as 'String'

 

How to achieve this?

 

Regards,

Deepak


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: How to use If and Set in Talend

Hi,

In tMap, you may try this expression on the output side for the field associated to "variable2":

 

row1.variable1 != null && 
row1.variable1.equalsIgnoreCase("Usage") && 
(row1.variable2 == null || row1.variable2.equals("")) ? "String" : row1.variable2

Hope this helps.

 


TRF

All Replies
Forteen Stars TRF
Forteen Stars

Re: How to use If and Set in Talend

Hi,

In tMap, you may try this expression on the output side for the field associated to "variable2":

 

row1.variable1 != null && 
row1.variable1.equalsIgnoreCase("Usage") && 
(row1.variable2 == null || row1.variable2.equals("")) ? "String" : row1.variable2

Hope this helps.

 


TRF
Six Stars

Re: How to use If and Set in Talend

Thanks it worked Smiley Happy

Forteen Stars TRF
Forteen Stars

Re: How to use If and Set in Talend

Great!
Don't forget to mark this case as solved (Kudos also accepted).

TRF