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: 
Karuetl
Creator II
Creator II

comma in double quote in a CSV delimited file

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"

Labels (2)
1 Solution

Accepted Solutions
akumar2301
Specialist II
Specialist II

@nthampi 

 

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.

View solution in original post

11 Replies
Anonymous
Not applicable

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 

0683p000009M2v2.png


treplace.PNG
Karuetl
Creator II
Creator II
Author

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)

Anonymous
Not applicable

oh i think your data type is not string.  convert that to string type and then process it.

Karuetl
Creator II
Creator II
Author

but table datatype is NUMBER(20,4)

akumar2301
Specialist II
Specialist II

Select csv option and advance separator (advance setting) No need to do anything else

Karuetl
Creator II
Creator II
Author

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

DataTeam1
Creator
Creator

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.

Anonymous
Not applicable

@Karuetl 

 

     Yes. You should read it as String and you can convert it to float later.

 

     Please refer the screen shots below for reference.

0683p000009M2v7.png

 

0683p000009M2qS.png

 

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 🙂

akumar2301
Specialist II
Specialist II

@nthampi 

 

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.