Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

adding randomly generated suffix to a duplicated value

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

Labels (2)
2 Replies
vapukov
Master II
Master II

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 

Anonymous
Not applicable
Author

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 🙂