One Star

[resolved] Input Delimited File Multiple Field Separators

Hey everyone,
In Excel it's possible to specify more than 1 column separator when you convert the text of a CSV file to columns, like , or ; or you can even specify a separator on your own.
Now the question I have is this: is it possible to have multiple field separators in a Delimited Input File component? I am currently using ";", but I'd like to have "|" as well. Any ideas?
Thanks!
Cihan
8 REPLIES
One Star

Re: [resolved] Input Delimited File Multiple Field Separators

Hello... You mean, have 2 delimiters in a file at the same time? Either ";" or "|"?
One Star

Re: [resolved] Input Delimited File Multiple Field Separators

Yes, in the same file, ";" and "|". I want to use both.
You can do it in Excel and I would like to know if you can use more than 1 field separator in Talend.
Thank you!
Five Stars

Re: [resolved] Input Delimited File Multiple Field Separators

design job like below this will solve your problem.

tFileInputfullRow-----tjavaRow----tExtractDelimitedField-------Main---YourOutput.
1. inTjavaRow generate code and write below statement.
output_row.line = input_row.line.replace("|", ";");
2. configure tExtractDelimitedField field component with filed-separator =";" and then add schema for same.

this way you don`t need to wary about more than on delimiter.
One Star

Re: [resolved] Input Delimited File Multiple Field Separators

Sorry for the late reply, because of the weekend + forum maintenance.
I have redesigned my job according to your message, but I'm getting the following error at the tJavaRow component:
"line cannot be resolved or is not a field"
When I check the schema of my tFileInputFullRow, my column is designated as "line", but somehow it doesn't get recognised.
Any ideas?
Moderator

Re: [resolved] Input Delimited File Multiple Field Separators

Hi cihanc83,

Did you use "Main" row between tFileInputFullRow and tjavarow? Would you mind uploading your job workflow screenshot into forum?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Input Delimited File Multiple Field Separators

Here is my screenshot (please ignore the deactivated job, that is the old one):

By the way, I love the new forum features, especially for uploading files and screenshots. They seem more intuitive now.
Moderator

Re: [resolved] Input Delimited File Multiple Field Separators

Hi,
Have you already clicked "Sync columns" in tjavaRow? Is there any error line when you switch to "Code" mode?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Input Delimited File Multiple Field Separators

Thanks everyone, that did it!