Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mantaq10
Contributor III
Contributor III

Looping over Filelist() with wierd symbols in filenames

Hi all,

I have a folder with lots of xml files, each having names with whitespaces and special characters. e.g. c:\my file is wierd (strange, obnoxious, wow).xml

I am trying to run this snippet but am not able to parse files with symbols like brackets '('. How do I enforce [ ] escaping within a filelist() call? I've tried putting [ ]  in both places but in vain...

let vFilePath = 'C:\Users\Atif\Desktop\KM PMO\Discovery\DataSource\Closure Document\*.xml';

for each File in filelist (vFilePath)

Load *

from $(File);

next File

Much Appreciated

A Business User

Atif

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

Its working properly.

Have a look at the example attched.

Only change the Root path.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
IAMDV
Luminary Alumni
Luminary Alumni

Atif,

Please can you provide the sample file? It'll be easy to work with the actual file.

Thanks,

DV


www.QlikShare.com

mantaq10
Contributor III
Contributor III
Author

Thanks Deepak for the quick response.

Here you go.

Right now, the parser churns out the string part starting from '('.

For other files, ',' is the culprit. Since there are 100's of files, i want to somehow incoporate a generic solution like an escape character, am plucking the last set of hair strands

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

Its working properly.

Have a look at the example attched.

Only change the Root path.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
mantaq10
Contributor III
Contributor III
Author

Thanks Kaushik,

However I got it solved with a similar code snippet...Appreciate your response.

let vFilePath = 'C:\Users\Atif\Desktop\KM PMO\Discovery\DataSource\Closure Document\';

for each File in filelist ('$(vFilePath)*.xml')

LOAD  *

  , filename() as Project_Name3

from [$(File)] (XmlSimple, Table is [myFields]) ;

next File