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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Character problem on a .csv file.

Hi all,
i have a .csv file. It has two fields and fields are separated with a comma(,) character. I have to remove-replace some characters as mentioned below ;
\0 (backlslash + zero) means NULL value ( means , there should be no character)
0 (zero) means true value of zero digit ( means , do nothing)
\, (backslash + comma) means true value of comma character (means remove backslash)
\ (backslash) means true value of backslash character ( means, do nothing)
, (comma) means a fiels separator
\\ (backslash + backslash) means true values of two backslash characters (means, do nothing)
\,, (backslash + comma + comma) means true value of comma following with field separator.

i have triend to use java replace command in tMap i could not do them correctly, what is the simple way to do them all?
Thanks
Best Regards
Bahadir.
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hello
Use a tFileInputFullRow to read the file line by line, and then do a replace processing on tMap, finally, output the rows to a new csv file.
row1.line.replaceAll("\\\\0", "").replaceAll("\\\\,", ",")

Best regards
Shong

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Hello
Can you give us an example and what are your expected result?
Best regards
Shong
Anonymous
Not applicable
Author

for example, the .csv file is like this;
"Zoologiska artiklar - Tillverkare Grossister\,",Limex AB Zoologisk handel,Trojs List Zoologisk handel,Norrköpings\0 Akvarier AB Zoologisk handel,ZOOPUNKTEN.SE / Skeneciklidhobby Zoologisk handel,Ulliz Zoo Zoologisk handel,AkvarieCenter\ Zoologisk handel\,,Akvariekällaren \\Zoologisk handel,DjurMagazinet Zoologisk handel,Akvariebutiken Strömstad Zoologisk handel,Mölnlycke Djur0
the .csv file that after i work on it must be like this one;
"Zoologiska artiklar - Tillverkare Grossister,",Limex AB Zoologisk handel,Trojs List Zoologisk handel,Norrköpings Akvarier AB Zoologisk handel,ZOOPUNKTEN.SE / Skeneciklidhobby Zoologisk handel,Ulliz Zoo Zoologisk handel,AkvarieCenter\ Zoologisk handel,,Akvariekällaren \\Zoologisk handel,DjurMagazinet Zoologisk handel,Akvariebutiken Strömstad Zoologisk handel,Mölnlycke Djur0
Anonymous
Not applicable
Author

Hello
Use a tFileInputFullRow to read the file line by line, and then do a replace processing on tMap, finally, output the rows to a new csv file.
row1.line.replaceAll("\\\\0", "").replaceAll("\\\\,", ",")

Best regards
Shong
Anonymous
Not applicable
Author

hi,
it works great, thank you Shong.
Best Regars
Bahadir