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

Announcements
Register by January 31 for $300 off your Qlik Connect pass: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Escaping characters

Hey guys,

i want to read all the .txt file from a folders (sub dir included) and i use the following script

sub DoDir (Root)
for each File in filelist (Root&'\*.' &'TXT')
lista_fisiere:
Load
'$(File)' as path
autogenerate 1;

next File
for each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
next Dir

end sub

DoDir(Path);

The script works fine till encounters one folder or txt files which contains quote character ( ' ) in the name.

Anyone know a workaround?

5 Replies
Not applicable
Author

You could use purgechar function to remove them

purgechar('$File', chr(39))

Regards,

Gordon

Not applicable
Author

I cant use PurgeChar because based on the name of the file i need to load that folder or not.

Not applicable
Author

have a batch file that renames the files prior to reload?

-Alex

Not applicable
Author

not a possible solution because those file are used by other application also

Not applicable
Author

Hi,

Use nested FOR loops . The quote will get escaped == will appear twice in the loaded field. Works in QV9 64 bits, and QV10 32 bits.



for each Dir in dirlist (Root&'\*' )
for each File in filelist (Dir &'\*.' &'TXT')
lista_fisiere:
Load
'$(File)' as path
autogenerate 1;

txt:
LOAD @1 as txt
FROM [$(File)] (txt, codepage is 1252, no labels, delimiter is '\t', msq);

next
next



-Alex