From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

tMap expression syntax


tMap is one of the core components of Talend Studio and is used very often in Jobs. The tMap component is primarily used for mapping input fields to output fields and transforming the input data in the Expression Builder of the corresponding output column. This article introduces the syntax to use in the Expression Builder, to help you understand and use the tMap component.



This procedure was written with:

  • Talend Open Studio for Data Integration 5.2.0
  • Sun JDK build 1.6.0_26-b03
  • Windows XP SP3

This procedure applies to all versions of Talend Studio.



Mapping Expressions

The Expression Builder allows you to type in a mapping expression for each column in each output table. This article presents the following syntax examples:


  • Basic mapping
  • Arithmetic operation
  • Calling Java class method
  • Calling Talend Routine
  • If / else statement


Basic mapping

tMap provides a graphical tool called Map Editor that allows you to more easily create the mapping from the input table to the output table using a drag-and-drop action. The following screenshot shows a simple mapping without any transformation from the input table to the output table. (Click the picture to see a full size image.)



In the screenshot above, you can see that the format used to map the input column in the Expression Builder of the corresponding output column is rowName.columnName, or row1.customer_id in this example. row1 is the row identifier of the input table, it is not a constant; it may change according to your Job. You can always read it at the top of each input table.


Concatenating fields

You can concatenate multiple fields using the + character in the Expression Builder. As long as the type of at least one of the fields is string, the multiple strings are connected, as shown below.



Setting output column with a constant

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 string type is set to a fixed value, Talend.



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


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


Note: 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 to 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 string, but an Integer/int value is set for this column.


Arithmetic operation

You can perform arithmetic operations including additions, subtractions, multiplications, and divisions in the Expression Builder.

As shown below, there is a new column called new_salary in the output table. Its value is the original salary plus 500.



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


Input table

employee_id Name Salary
1 Elisa 12000
2 Nicolas 13000
3 Patrick 10000


Output table

employee_id Name Salary new_salary
1 Elisa 12000 12500
2 Nicolas 13000 13500
3 Patrick 10000 10500


Calling a Java class method

You can call a Java class method to transform the input fields in the Expression Builder. Call the Java method to achieve the following task: cut the first 4 characters from the input field of long type, and convert the result to a value of Integer/int type.



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


Input table

customer_id account_num
1 87462024688
2 87514054179


Output table

customer_id account_num
1 8746
2 8751


Calling a Talend Routine

You can call a Talend Routine in the Expression Builder. For example, you can call a system routine function Numeric.sequence("s1",1,1) to generate a sequence number for each row.



If/else statement

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:


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.



Filter Expressions

In the tMap, you can click the filter button and write a filter expression to filter the output data, as shown below:



If there are multiple conditions, you need to use the logical operators (AND, OR) to combine multiple conditions. For example:

AND operator: all conditions should be satisfied.


In this example, the postal_code should not be null AND the gender should be F.

OR operator: one condition should be satisfied."CN")||"FR")||"US")

In this example, the country should be one of CN, FR, or US.

Version history
Revision #:
7 of 7
Last update:
‎02-24-2019 11:20 PM
Updated by:
Labels (2)
Four Stars

Good document! But I've some doubt.

How can I make more than one condition receive some value in a expression builder?

For example:


row1.column.equals("ABC") recibe the value 2 or row1.column.equals("DEF") recibe the value 3




Six Stars

@Rick84, you can use nested ternary operators. Your example can be rewritten as,


(row1.column.equals("ABC") ? 2 : (row1.column.equals("DEF") ? 3 : -1))
Six Stars

Good One! how can I handle null values for numeric values??  

how can I handle the null values for numeric columns?? I used following expression in tMap but throwing an error.

Ex: Relational.ISNULL(row1.Amount)?1500:row1.Amount 


Error Line: 1169

Detail Message: Type mismatch: cannot convert from Number&Comparable<?> to BigDecimal
There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio.
Job Job_Data_Null_Comm_Load ended at 16:06 21/09/2017. [exit code=0]





Community Manager
@apentyala, it is type mismatch error, what is the data type of Amount column in input table and output table?
Six Stars

@shong thanks, The issue was resolved, I used the following syntax.

row1.Amount==null? new BigDecimal("1500"):row1.Amount




One Star

I get a talend job by another person. I imported the job. This job is for a PostgreSQL DB. I Use Informix DB. the job contains a tinput component for PostgreSQL so i cant work with it for my Informix DB: 


I want to change the tinput component to Informix but if i do so, i lost all "Input" Data in the Tmap Component. The Source Tabels in booth DBs PostgreSQL and Informix are indentical so i just want to change the Job to Informix as Input DB without loseing all the content of the Input in the Tmap Component. Is this Possible or do i need to rebuild the input component and all the connections to the destination component again? thx for your help. 

Community Manager

Hi Ricon,

Due to vacations, you might get a faster answer by posting your question to one of the discussion forums, or for technical support please file a ticket at .

Hope that helps,


Two Stars

Good Document,


Any advice as to how to handle Dynamic columns, I mean, if we don't know the number of columns, the input field has (it changes dynamically) and we have to process only exactly that many columns?

Community Manager

Hi yashvijay_17

You need to hard code to get the column properties such as column name, and do the transformation, see screenshot



Hope it is helpful!




Two Stars

very good artical helped me lot....

Four Stars

This is an extremely helpful synopsis. It has provided a huge bootstrap to my understanding of the power of tMap expressions. 

I've been wrestling with correcting rows in a huge table where users entered data as "Lastname, Firstname" in the LastName column, leaving the FirstName column blank. How to get it sorted out properly into separate FirstName and Lastname column data for the affected rows? tMap to the rescue! 


The only thing I would want to see added to this great article would be a section on using regex matching within expressions. 

Two Stars
Two Stars

Nice Document.

I have a Query

Using tMap expression builder I need to arrange the data based on below criteria.

For example : Based on Order Id,  if Order Id begins with 'LAB' and 'BA' then the data should flow to coulmn OrderType as Work Order and everything else as Trigger.

Data example : LAB_MOVE-100 and BA123456

Tried using (input.columnname.startsWith("LAB_") || input.columnname.startsWith("BA")) ? "Work Order" : "Trigger"    and it did not work

Community Manager

@MSR, Let's move to the Discussion board, can you please open a topic for your problem with details? We will check and help you.




Five Stars

Why does the following Expression not work?


It should Filter all Rows where the field ObjectHeader begins with "S" but it doesn't


thx Stefan 

Community Manager

@PITadmin , you should use the equals("S") instead of =,  



Five Stars

This brings a NullPointerException

Exception in component tMap_2 (Import_ABB_Master_CSV)
at abb_zaehler_import.import_abb_master_csv_0_1.Import_ABB_Master_CSV.tFileInputDelimited_2Process(
at abb_zaehler_import.import_abb_master_csv_0_1.Import_ABB_Master_CSV.runJobInTOS(
at abb_zaehler_import.import_abb_master_csv_0_1.Import_ABB_Master_CSV.main(

Five Stars

Forget my earlier message, it works.

Thx a lot!