Search code examples
etltalend

Conditional Mapping in Talend


I have created a simple job in Talend that will perform an inner join in the data between 2 excel sheets and then dump the result in an output excel sheet. This can be best illustrated by the below diagram :-

enter image description here

The mapping used in tMap is :-

enter image description here

However the additional challenge for me now is that I have to perform this mapping only if the column value in that row is not NULL. eg there is a mapping row1.RECID = row2.RECID, but this should only be legal if row2.RECID is not NULL. How do I achieve this in Talend? I have experimented a lot with tMap expressions but can't get it right..
Here is a small sample input and it's corresponding expected output. Suppose my input has values :- v1, v2,v3,v4
1 , A, O, 3
2, B, X, 4
3, C, X, 4

and lookup has values

v1, v2, v3
1, A, O, 3
2, null, X, 4
3, null, C, 4
2,null,X,null

Then the output should be :-
v1,v2,v3
1,A,O,3
2,B,X,4
2,B,X,4


Solution

  • Before joining your input flows, you have to reject rows with null values, I have created a mapping based on the given simple data.

    enter image description here