Search code examples
talendtalend-mdm

Generate specific key for specific code in Talend


i want to generate specific numbers for specific codes in talend. Some of the codes are repeating, but i dont want to generate a different numerical sequence for that code. In tMap i used Numeric.sequence("out1.CODE",1,1) but it didnt help. Is there a way to replace the key based on the previous matching code. pls help

Table 1

code
ABC
ACC
AEB
ACC
AED
BEE
AEB

Required Result

Table 1

code key
ABC 1
ACC 2
AEB 3
ACC 2
AED 4
BEE 5
AEB 3

Solution

  • Your job design would look like this

    enter image description here

    1- tMap_2 is configured as such

    enter image description here

    2- thashinput_1 would call thashoutput_1 and tick in the tUniqRow_1 : **Code**

    3- tmap_4 configuration is configured as such :

    enter image description here

    4- tmap_5 configuration is configured as such :

    enter image description here

    Here is my output :

    Starting job string at 16:22 10/05/2022.
    [statistics] connecting to socket on port 3404
    [statistics] connected
     .----+---.
     |tLogRow_3|
     |=---+--=|
     |code|key|
     |=---+--=|
     |ABC |1  |
     |ACC |2  |
     |AEB |3  |
     |AED |5  |
     |BEE |6  |
     |ACC |2  |
     |AEB |3  |
     '----+---'
    
     [statistics] disconnected
    
     Job string ended at 16:22 10/05/2022. [exit code  = 0]