Lookup Functionality in tMap Component

One Star

Lookup Functionality in tMap Component

Hi,
Does anyone tried lookup function with multiple condition in tMap?

Input ------ tMap ------ Output
                   |
            Lookup Input
Scenario is I have 1 field in the Input and 3 fields in the Lookup. The condition should be:
~ if input field is equal to first field in Lookup, output the third field
~ else if input field is equal to second field in Lookup, output the third field
~ else, output null
Basically, I want to have OR operation inside the tMap. If anyone knows how to do this, I gladly appreciate it. Thanks in advance.

Example:

Input Data
  field1   |
|      A     |
|      B     |
|      C     |
|      D     |


Lookup Data
|   colA   |   colB   |   colC    |
|     A     |    B     | output1 |
|     E     |    G     | output2 |
|     D     |    A     | output3 |
|     F     |    C     | output4 |

Expected Output
field1   |   colC     
   A      | output1
   B      | output1
   C      | output4
   D      | output3

Community Manager

Re: Lookup Functionality in tMap Component

Hi 

No OR logic on the lookup feature, you need to do the join two times for each filed, and then merge the result. eg:
input1--main--Map--out1--tHashOutput1
                      |
                 lookup(colA)
 |
onsubjobok
  |
input1--main--Map--out1--tHashOutput2
                      |
                 lookup(colB)
  |
onsubjobok
  |
tHashInput1--main--map--out1....
                              |
                          lookup
                              |
                         thashInput2

thashInput1: read data from thashOutput1
thashInput2: read data from thashOutput2

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog