Talend tMap filter rows

In this Talend article, we show how to use the Talend tMap component to filter rows based on the expression. We can use the Talend tMap as an alternative to tFilterRow to filter rows or records in a table.

To demonstrate the Talend tMap filter rows, we use the same Customer data that we used in the tFilterRow example. So, let me use the tDBInput to select the table.

Talend tMap Filter Rows 1

Drag and drop the Talend tMap into the job design, and connect the tDBInput Main row to tMap.

Talend tMap Filter Rows 2

Double-click on the tMap will open the following window.

Talend tMap Filter Rows 3

Click the Plus (+) button to add a new output to this Talend tMap, and we named it as Filtered_Rows.

Talend tMap Filter Rows 4

Drag all the available columns in row1 to Filter_Rows output.

Talend tMap Filter Rows 5

Please click on the little expression icon will open an empty space to write an expression.

Talend tMap Filter Rows 6

The following expression will show you the customers whose Occupation is not equal to Clerical.

Talend tMap Filter Rows 7

Let me use the tLogRow to display the Talend tMap filter rows output.

Talend tMap Filter Rows 8

Run the Talend tMap filter rows job to see the output.

Talend tMap Filter Rows 9

We can also write multiple expressions or conditions to filter the output rows. To write the complex expression or if you don’t know the function names, please click on the browse button. It opens the expression builder, use it to view all the available built-in functions of the Talend. Here, we added one more condition that filters employees whose yearly income is greater than 50000.

Talend tMap Filter Rows 10

You can see all the records whose income is greater than 50000 and Occupation not equal to Clerical.

Talend tMap Filter Rows 11

Next, we added one more output to show the rejected rows and added all the rows to it.

Talend tMap Filter Rows 12

Please change the Catch output reject option from default false to True.

Talend tMap Filter Rows 13

Click the Ok button to close the Talend tMap window.

Talend tMap Filter Rows 14

Now, you can see the rejected rows or rows doesn’t meet the expression. 

Talend tMap Filter Rows 15