Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Weird issue with filelist function + wildcard + CSV files

Hi !

I am using the filelist() function along with a "for each" in order to load several CSV files. I am using QV 11.20.

This particular piece of code :

For each vFile in FileList('.\*.csv')

trace file : $(vFile);

sleep 2000;

Next vFile

leads to load *.csv file which is the expected behavior, but it also loads *.csv*. It means it loads also *.csv_old for example.

I tried also with xlsx files, but it behaves correctly in that case. This seems specific to CSV files.

Is there any mean to disable this strange behavior ?

Thanks,

Laurent

Tags (3)
4 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Weird issue with filelist function + wildcard + CSV files

It looks like a bug .... You could as workaround check the extension directly or the len(extension) in an additionally step like:

if subfield('$(vFile)', '.', -1) = 'csv' then

...

end if

- Marcus

Highlighted
Not applicable

Re: Weird issue with filelist function + wildcard + CSV files

Thanks Marcus.

Actually, we used a similar code to bypass this bug :

if('$(vFile)' like '*.csv') then

...

end if

Laurent

Highlighted
pljsoftware
Contributor III

Re: Weird issue with filelist function + wildcard + CSV files

Hi Laurent,

this is a bug, reports to Qlikview.

Thanks for your note.

Luca Jonathan Panetta

Highlighted
bestofwest
Contributor II

Re: Weird issue with filelist function + wildcard + CSV files

Yes. It's a bug.

Test the filename extension individually inside loop.

Caria