Setting output column with a constant - 6.1

tMap expression syntax

Shicong Hong
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
Data Governance > Third-party systems > Processing components (Integration)
Data Quality and Preparation > Third-party systems > Processing components (Integration)
Design and Development > Third-party systems > Processing components (Integration)
Talend Studio

You can set a constant to an output column in the Expression Builder, without mapping from the input columns. As shown below, the company column of type String is set to a fixed value, Talend.

The input data will be transformed to output data after being processed into the tMap component.

Input table:

employee_id name
1 Elisa
2 Nicolas
3 Patrick

Output table:

employee_id name company
1 Elisa Talend
2 Nicolas Talend
3 Patrick Talend

The data type of the value in the Expression Builder should be consistent with the data type of the output column. Otherwise, it will throw a Java compilation error. For example, if a constant 1 is set for company column in the Expression Builder, it will throw a compilation error when the Job is executed: Type mismatch: cannot convert from int to String, because the data type of the company column is defined as type String, but an Integer/int value is set for this column.