0

I have one table with different columns. The columns belong to an Id, x and y. I would like to map those columns into One unique ID, X and Y using talend: I have a connection to my DB from MySQL to Talend. Im adding my table as a "MySQLInput".
The table looks like:

idN| XN  |YN   | idT |XT   | YT
1  | 2.5 | 4.5 | 2   | 6.9 | 2.7
2  | 6.9 | 2.7 | 7   | 9.9 | 2.1
5  | 4.6 | 6.6 | 9   | 1.3 | 5.5
7  | 3.2 | 7.8 | 6   | 3.2 | 3.1

I want this table as a result after mapping with talend:

idU | XU | YU
1   | 2.5 | 4.5
2   | 6.9 | 2.7
5   | 4.6 | 6.6
6   | 3.2 | 3.1
7   | 3.2 | 7.8
7   | 9.9 | 2.1
9   | 1.3 | 5.5

I try to do that:

enter image description here

But the result is not what i expect:

IDU | XU | YU
1 | 2.5  | 4.5
2 | 6.9  | 2.7
5 | 4.6  | 6.6
7 | 3.2  | 7.8

I have tried also doing this:

enter image description here

using that expression but code gives me an error.

I also tried to create my own routine and using it in the Expression builder but still not working.

Does anyone have hint about how to conduct this mapping, or what component to use. The thing is that i don't have only 2 times the same columns but three or more in the same table and I need to map them all at one final and unique column per each one of the similar variables.

thanks for taking your time to reading this , and double thanks to answer it :)

tobi6
  • 8,033
  • 6
  • 26
  • 41
John Perez
  • 117
  • 10

1 Answers1

1

Here's a simple solution using tSplitRow:

enter image description here

You need to split each incoming row into 2 rows: one with idN, XN, YN and the 2nd one having the columns idT, XT, YT. tSplitRow has the columns id, X, Y.
Then use a tUniqRow to filter out duplicates, like this :

enter image description here

And the output :

.--+---+---.
|tLogRow_5 |
|=-+---+--=|
|id|X  |Y  |
|=-+---+--=|
|1 |2.5|4.5|
|2 |6.9|2.7|
|7 |9.9|2.1|
|5 |4.6|6.6|
|9 |1.3|5.5|
|7 |3.2|7.8|
|6 |3.2|3.1|
'--+---+---'
Ibrahim Mezouar
  • 3,981
  • 1
  • 18
  • 22
  • wow! is perfect! you saved my life! So sad that I do not have the power to give you a point! You have my eternal gratitude. By the way, I have problems performing that operation but because of size of the archive. Which component could be added to this model of yours to run the process. I try Changing the argument Xms and XMx but still doesn't work – John Perez Jan 24 '18 at 10:40
  • I'm glad to be of help :) I'm not sure I understand your problem, could you please post another question with details and I'll look at it – Ibrahim Mezouar Jan 24 '18 at 11:57
  • thanks! I posed it there: https://stackoverflow.com/questions/48427368/talend-memory-issues-working-with-big-files – John Perez Jan 24 '18 at 16:33