Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In Talend what is the best way to generate a unique key from the first character of the first name + 3 first characters of the last name + integer in order to prevent duplication. I can generate the Alias key using string functions in my tMap, but do not know how to add sequence number if needed.
The WorkerId is the unique key used by the software, the alias is intended to be a more user-friendly and generated off first and last names.
# SAMPLE DATA INPUT (first row header)
'WorkerId','FirstName','LastName','AliasCandidate'
'1080','Carl','Smith','CSMI'
'6774','Charlie','Smith','CSMI'
'6787','Carol','Smith','CSMI'
'6327','Carl','Wright','CWRI'
'4619','Carol','Wrigley','CWRI'
'6767','Chris','Wright','CWRI'
# DESIRED RESULT SET (first row header)
'WorkerId', 'Alias'
'1080', 'CSMI'
'6774', 'CSMI1'
'6787', 'CSMI2'
'6327', 'CWRI'
'4619', 'CWRI1'
'6767', 'CWRI2'
I am new to Talend and unsure what it means when support says: "You could do a lookup in the tmap and then set the expression based on the lookup."
Please advise.
row1.alias + routines.Numeric.sequence(row1.alias, 1, 1)
row1.alias + routines.Numeric.sequence(row1.alias, 1, 1)
int code_num = 0; String code_alpha = input_row.Alias.substring(0,4);
if ( input_row.Alias.length() > 4 ) { code_num = Integer.parseInt( input_row.Alias.substring(4, input_row.Alias.length() ) ); }
Numeric.sequence(code_alpha, code_num, 1);
Numeric.sequence(row4.Alias,1,1)