If/else statement - 7.0

tMap

author
Talend Documentation Team
EnrichVersion
7.0
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance > Third-party systems > Processing components (Integration) > tMap
Data Quality and Preparation > Third-party systems > Processing components (Integration) > tMap
Design and Development > Third-party systems > Processing components (Integration) > tMap
EnrichPlatform
Talend Studio

In the Expression Builder, the if / else statement can be written as follows:

condition?value if true:value if false

You can perform a null test before calling a Java method; otherwise it will throw a null pointer exception if the input data contains a null value. For example:

row1.Postal_code==null?null:row1.Postal_code.toUpperCase()

You can also write a nested statement. For example, use the following expression to retrieve the new salary for each employee based on his/her original salary.

row1.salary>=10000?row1.salary*1.05:(row1.salary>=8000?row1.salary*1.1:(row1.salary>=7000?row1.salary*1.08:row1.salary*1.2))