Four Stars

Column transformation -and finding distinct and corresponding values


Can anyone please help me over this.

My input in excel is like below:

Source_Field Source_value Target_value
Field1 Src1 Tr1
Field2 Src2 Tr2
Field1 Src3 Tr3
Field1 Src4 Tr4
Field3 Src5 Tr5
Field2 Src6 Tr6


And I want output like this:

Field1   Field2   Field3  
Source_value Target_value Source_value Target_value Source_value Target_value
Src1 Tr1 Src2 Tr2 Src5 Tr5
Src3 Tr3 Src6 Tr6    
Src4 Tr4        


How can I get this using talend?


Thirteen Stars TRF
Thirteen Stars

Re: Column transformation -and finding distinct and corresponding values

here is my proposal:


1st step add a sequence number for each value of source_field and memorize the result in a tHashOutput:



2nd step, join different source_field values with the same rank and format the output flow.

Here is the join to get field1 and associated field2, just repeat the same operation for field3:


And here is the right part to format the output flow:


And the final result:

Starting job test at 00:04 05/07/2017.

[statistics] connecting to socket on port 3583
[statistics] connected
|                                    tLogRow_48                                     |
|src1         |tr1          |src2         |tr2          |src5         |tr5          |
|src3         |tr3          |src6         |tr6          |             |             |
|src4         |tr4          |             |             |             |             |
[statistics] disconnected
Job test ended at 00:04 05/07/2017. [exit code=0]

Hope this helps.