Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm retrieving data from a database with the field id (PK) | name fields and I'm supposed to input values from these 2 fields in to another database. However the names in the source database are not unique and I want to have unique names by adding a randomly generated string to it for example
testname becomes testname-1223489
after my input from the data source, I added the sort row component to sort the name field, and tuniqrow to find the duplicated fields. What are the next steps I should be doing to add the random suffix to the duplicated values in the name column?
Thanks
generally, if you need only this, it possible to use tSortRow + tJavaRow (tJavaFlex)
define context variable - current_name
store first row into context variable
then for each row:
- name == context variable? -> name = name+sequence
- if not, store new name into context variable
Hi,
If you are not inclined to use tJava components, another method is to do the lookup with target table to identify the existing data and new data (when you are doing left outer join, only new elements will have blank value in lookup). Once existing data is identified, then you can add an additional sequence number as tie-braker for duplicate data.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂