Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
amtkmr1990
Contributor II
Contributor II

dealing with csv delimiter like ,, and ""

Hi Team, 

I have csv file like 

col_1, col_2, col_3, col_4, col_5, col_6

abc,,,,,xyz

mno," "," "," ","0","0",abc

 

In Talend TOS, while reading this csv file, HOW CAN DO FOLLOWING 

1. convert the cols where there is no value like ,,, to -> NULL and insert to DB

2. convert the cols where there is only qoutes like "","","" to -> NULL and insert to DB

 

Please suggest 

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

"". equals(row1.myField) || "\" \"".equals(row1.myField) ? null : row1.myField

View solution in original post

3 Replies
iamabhishek
Creator III
Creator III

Prepare your job flow like this - 

tFileInputDelimited- > main - > tMap - > main -> tDbOutput (the respective db output component as per your use-case)

 

In tMap you need to search for replace the values for each of your input columns, like this - 

row42.col_2.isEmpty()? null : row42.col_2 
(row42.col_3.startsWith("\"") && row42.col_3.endsWith("\"")) ? null : row42.col_3 

the above code is simply looking for any blank string (no value) and making it null. 
The next one is searching for quotes ("") and making it null - to be double sure you could also check for the length (length = 2) in case if any input column has double quotes to start and end with.

Also in your tMap output do remember to make your output columns as nullable.

TRF
Champion II
Champion II

"". equals(row1.myField) || "\" \"".equals(row1.myField) ? null : row1.myField
amtkmr1990
Contributor II
Contributor II
Author

thanks will check ...