white spaces row in tFileInputDelimited

One Star

white spaces row in tFileInputDelimited

Hy,
I use the Java Talend version and i have a file with some white spaces row.
I check the option "skip empty rows", but the process stop in error at this lines.
Do you have a idea of a solution ?
Can i use regExp for "Row separator" ?
thanks.
Employee

Re: white spaces row in tFileInputDelimited

Hello,
which version of Talend Open Studio do you use ?
Can you attached your file with empty rows ?
Which error do you have ?
One Star

Re: white spaces row in tFileInputDelimited

hello,
the version is V2.1.2.
the error is :
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "Invalid Character", delete this token
n cannot be resolved
at testxmis.ajouttcn.AjoutTcn.tFileInputDelimited_3Process(AjoutTcn.java:368)
at testxmis.ajouttcn.AjoutTcn.main(AjoutTcn.java:842)
example file :
1/960725603/2007-08-28/0814//////////////////87/193318/40/FRBRJ/RUDAAW/2007-08-28/0814/37.50/01/37.50/CA///87/192039/87/113001;
1/964467965/2007-08-28/1657/////////////////85/87/072595/22/FRSCF/TRWXHX/2007-08-28/1657/84.00/01/84.00/CA///87/113001/85/000109;
1/965403670/2007-08-28/1906//////////////////87/784009/2/FRPGF/TDWHKU/2007-08-28/1906/23.40/01/23.40/CB///87/784009/87/611004;

1/962810203/2007-08-28/1318//////////////////87/726000/2/FRHHD/SVUKDT/2007-08-28/1318/56.50/01/56.50/CB///87/726000/87/784009;
the only solution i have find is to parse the file before use the talend class.

thanks.
Employee

Re: white spaces row in tFileInputDelimited

It seems that you have a compilation error in the generated code.
If you switch in the "Code" tab of your job designer, you should have at least one error visible in the right vertical ruler.
Could you provide a capture of you error ?
One Star

Re: white spaces row in tFileInputDelimited

Hello,
i had a error in the code with the row separator who was \n and not "\n".
Now the error is a error of cast of the first field :
Exception in component tFileInputDelimited_3
java.lang.NumberFormatException: For input string: " "
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at routines.system.ParserUtils.parseTo_Integer(ParserUtils.java:62)
at testxmis.ajouttcn.AjoutTcn.tFileInputDelimited_3Process(AjoutTcn.java:373)
at testxmis.ajouttcn.AjoutTcn.main(AjoutTcn.java:858)
Employee

Re: white spaces row in tFileInputDelimited

It's probably the empty columns ("\\\\\") in your file that cannot be parsed to int by java.lang.Integer.parseInt
One Star

Re: white spaces row in tFileInputDelimited

The job is ok with empty columns.
he stop after 9000 lines when he arrive to the empty line with white space.
He want to cast into a int the white spaces.
Is there a way to parse the file before put a tFileInput ?
If there is no solution with talend, i'm gone treat the file before the talend job.
Thanks.
Employee

Re: white spaces row in tFileInputDelimited

If you have multiple datas type in your "columns" you can read them as String and convert them in a tMap with such expressions :
Integer.parseInt(row1.myColumn)
Regards,
Michaël.
Employee

Re: white spaces row in tFileInputDelimited

Is your problem solved now ?