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

How to split a field with comma separated values

I have a csv file that I need to transform and export out a NEW csv file.
My current path is:
tFileInputDelimited_1 --> tMap_1 --> tBufferOutput_1 --> tFileOutputDelimited_1

The column, "Full Name" has "Last Name, First Name" in one string and i need to extract both names and place them into two different columns.
Is there a TRIM function i am missing that will allow me to trim from the comma in the string?
Labels (2)
6 Replies
Anonymous
Not applicable
Author

Hi davidag1,
Maybe a look at the tExtractRegexFields component will give you a clue.
For instance : https://community.talend.com/t5/Design-and-Development/java-lang-NoSuchMethodError-routines-Numeric-...
PS : Your tBufferOutput is maybe not mandatory in this kind of job
Regards,
Cyril
Anonymous
Not applicable
Author

Column Name: Full_Name
e.g. Full_Name = Gonzalez, David
I am trying to use the tExtractRegexFields with the following command
^(?<LastName>\w+),\s?(?<FirstName>\w+)$

Which works with in Regex Builder but not in tExtractRegexFields -- it complains "Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\)
Any ideas?
Anonymous
Not applicable
Author

Avoid the regex for such simple split... just use tExtractdelimfields to generate two field out of one....
Anonymous
Not applicable
Author

thx emaxt6
I got the job to work with the following:
tFileInputDelimited_1 --> tExtractDelimitedFields_1 --> tMap_1 --> tFileOutputDelimited_1
alevy
Specialist
Specialist

Re your problem with tExtractRegexFields: remember that \ is an escape character for Java and regex so to use a regex shorthand character class such as \w in Talend (Java), you need \\w.
Anonymous
Not applicable
Author

Thank you alevy!