Introduction

In this article, we will learn about the use of the Catch Reject Output settings in tMap components with a real-time example. As we assume you have already had experience with connections and basic talend design.

To learn more about on tMap component, other tMap settings, and its benefits, read my previous articles Working With The tMap Component In Real-Time Examples - Part 1 and Mapping Componet(tMap) In Talend Open Studio

tMap Examples

In this job, we are going to join multiple data from different sources (here files) into a single data (table) using tMap component. Input files are read by tFileInputDelimited component and output data is printed by tLogRow component. Here student data are taken as an example.

In this example, we are going to check how catch output reject setting in output panel works.

Input data

In this example, we take the input data from the 3 text files using tFileInputDelimited component.

Example 1

Join model is left outer join, the expression filter condition on output panel can only apply on main table data because lookup table might have null values. Catch output reject is false, so reject from output table is not caught in the output.

For this example, we have created the below job.

Property Value Description
Input Panel - tMap settings
Join Model Left Outer Join The output data have all the main table data, primary key matched lookup table data and if primary key value is not in the lookup table then the lookup table columns have null value.
Output Panel - tMap settings
Catch output reject False Output reject won't catch

How to use Catch Output Reject in tMap Component with Examples

Output

Id column in primary_details table is taken as a primary key. Id 114 is not in the mark_details but in primary_detials table. So in output table 114 is not given.

Example 2

Join model is left outer join, the expression filter condition on output panel can only apply to main table data because lookup table might have null values. Catch output reject is true, due to filter condition reject from the output table is caught in the next output table.

For this example, we have created the below job.

Property Value Description
Input Panel - tMap settings
Join Model Left Outer Join The output data have all the main table data, primary key matched lookup table data and if primary key value is not in the lookup table then the lookup table columns have null value.
Output Panel - tMap settings
Catch output reject True reject from the first output table will catch in second output table

How to use Catch Output Reject in tMap Component with Examples

Output

tLogRow1 prints the 1st output from the tmap.On the first output table, we have applied the filter, where Id 114 should filter from the primary_detail table.

tLogRow2 prints the 2nd output from the tmap. In the second output table, we have applied the catch output reject is true, so it will catch the reject from the primary_detail table from the filter. Rejected 114 IDs will print in the 2nd output table.

Example 3

Join model is inner join, the expression filter condition can apply on both main and lookup table. Catch output reject is false, so reject won't catch in output.

For this example, we have created the below job.

Property Value Description
Input Panel - tMap settings
Join Model Inner Join The output data have the primary key matched data between both Main and Lookup table
Output Panel - tMap settings
Catch output reject False Output reject won't catch

How to use Catch Output Reject in tMap Component with Examples

Output

In expression filter, we have conditioned to print only the student who has total less than 340. This condition rejects the 355 total students.

Example 4

Join model is an inner join, the expression filter condition can apply on both main and lookup tables. Catch output reject is true, due to filter condition reject from the output table is caught in the next output table.

Property Value Description
Input Panel - tMap settings
Join Model Inner Join The output data have the primary key matched data between both Main and Lookup table
Output Panel - tMap settings
Catch output reject True reject from the first output table will catch in second output table

Scenario 1

In this scenario, we are trying to print the reject the first output table.

For this, we have created the below job.

How to use Catch Output Reject in tMap Component with Examples

Output

Scenario 2

For this, We have created the below job.

How to use Catch Output Reject in tMap Component with Examples

Output

Scenario 3

Job is same only changes in tMap editor.

How to use Catch Output Reject in tMap Component with Examples

Output

Summary

In this article, you have learned about the how tMap component works on the various scenarios with examples.