Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a file which is enclosed with double quotes with comma separated
but one column has comma within the double quotes , it failed when reading "2,453.240"
Why do we need to read it as String ?
I just tried with sample input like
"2,34.2300",acd
I just selected CSV option and advance number separator. I selected 1st field as Float.
I have output like this,
[statistics] connected
234.23|acd
[statistics] disconnected
Do we need tMap/tReplace here ?Otherwise , I misunderstood the question.
When you read the tfiledelimited, after that use tfileereplace component, them replace all , with empty without space like this"", by this way all commas will be gone
or
i think you need to change field separator in the file from , to any other symbol
Detail Message: The method replaceAllStrictly(String, String, String, boolean, boolean) in the type StringUtils is not applicable for the arguments (Float, String, String, boolean, boolean)
oh i think your data type is not string. convert that to string type and then process it.
but table datatype is NUMBER(20,4)
Select csv option and advance separator (advance setting) No need to do anything else
yes i selected but failed as some other columns are integer .. Should i select datatype as string in file input ? also table has number(20,4) datatype
Yes, I think you should select datatype as string in file input and in the second step you can use tMap and then convert value back to number.
Yes. You should read it as String and you can convert it to float later.
Please refer the screen shots below for reference.
Relational.ISNULL(row1.data)?null:Float.valueOf(row1.data.replaceAll(",", ""))
I have added additional code for NULL check also. Hope it will help you.
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 🙂
Why do we need to read it as String ?
I just tried with sample input like
"2,34.2300",acd
I just selected CSV option and advance number separator. I selected 1st field as Float.
I have output like this,
[statistics] connected
234.23|acd
[statistics] disconnected
Do we need tMap/tReplace here ?Otherwise , I misunderstood the question.