QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Exclude directories from a DirList

I have a very simple script loading every QVX file from all sub-directories of a directory.

4 Replies

Re: Exclude directories from a DirList

You will need a list of these directories which you want or which you not want - which one is shorter? Then you could use outside from your loop another loop or call these loop. Another possibility could be a if-loop inside your loop to check if these folder in your list or not.

- Marcus

Not applicable

Re: Exclude directories from a DirList

Isn't there a coding pattern on how to kick out list elements from a list?

This seems better style to me.

Re: Exclude directories from a DirList

directory;

for each dir_name in DirList('*')

if match($(dir_name), 'bar','baz','foobar') = 0 then load * from$(dir_name)\*.qvx (qvx);

end if

NEXT;

Not applicable

Re: Re: Exclude directories from a DirList

This is what worked for me. Note the single quotes around the sub-directory variable and sub-directories to be excluded.

Also I can use QvWorkPath because there is a "directory;" statement just before.

 directory; FOR Each dir_name in DirList('*') IF  match('$(dir_name)','$(QvWorkPath)\bar','$(QvWorkPath)\baz','$(QvWorkPath)\foobar')= 0 then     load * from \$(dir_name)\*.qvx (qvx); END IF; NEXT;