Setting output column with a constant

tMap

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