Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
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
Highlighted
Not applicable

Escaping characters

You could use purgechar function to remove them

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

Regards,

Gordon

Highlighted
Not applicable

Escaping characters

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

Highlighted
Not applicable

Escaping characters

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

-Alex

Highlighted
Not applicable

Escaping characters

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

Highlighted
Not applicable

Escaping characters

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