Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys!!
I'm a beginner in Talend. I would appreciate your help with the next topic:
I'm creating a .csv from a DB. I'm using tmap to tranfer the data from the DB to the .csv, doing some changes. My problem is with a new field I want to create.
Some different registers can have the same ID, so in my .csv I can get something like this:
0001|.....
0001|....
0001|....
What I'm trying to do is to create a new field (column in the .csv) that works like a meter, to know how many times the ID is repeated --> example:
0001|1
0001|2
0001|3
I have try it in the tMap, codding the field function... but I just achive to compare this table row with other table rows, but for the same record, not for every one....
Any solution is welcome, even if it has to be developed outside the tmap.
thanks in advance
Kind regards,
Jorge
@Moe - you could use Numeric.sequence to generate a sequence number for your input.
Something like this -
tMap configuration -
Edit: For multiple input just have a tSortRow between your input component and tMap
@Moe - you could use Numeric.sequence to generate a sequence number for your input.
Something like this -
tMap configuration -
Edit: For multiple input just have a tSortRow between your input component and tMap
Thanks @iamabhishek for your quick answer.
I have tried what you proposed (I attack a screenshot) , but I got something like that:
0001|1.....
0002|2.....
0002|3.....
0003|4....
0003|5....
0003|6...
0004|7...
And what I need is :
0001|1.....
0002|1.....
0002|2.....
0003|1....
0003|2....
0003|3...
0004|1...
I need to restart the meter or the sequence every time the Id is different.
Thank you again.
Kind regards
Jorge