Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

DirList() and FileList()

Hi experts,

Can someone explain me haw these functions work and what is their syntax?  I am really confused how to use them, I looked at the reference manual and I tried something like this:

For each Ext in FileList('C:\Users\Gabika\Desktop\*.x*')

Main:

LOAD

'$(vFile)' as File

AutoGenerate (1);

Whatever I tried write in bracket, the result is still: c:\Program Files\QlikView\Themes\Wind.qvt 

Thank you for your answer.

1 Solution

Accepted Solutions
Highlighted
Not applicable

Re: DirList() and FileList()

Root is just a parameter of such sub, which defines where your search will start from. When you invoke this sub, you use C:\ as root, which means you will search those files from C:\ and its sub-folders.

View solution in original post

8 Replies
Highlighted
Champion
Champion

Re: DirList() and FileList()

Find example from ref. manual.

// example 2 - list all QV related files on disk

sub DoDir (Root)

for each Ext in 'qvw','qvo','qvs','qvt','qvd'

for each File in filelist (Root&'\*.'&Ext)

Load '$(File)' as Name,

FileSize('$(File)') as Size,

FileTime('$(File)') as FileTime

autogenerate 1;

next File

next Ext

for each Dir in dirlist (Root&'\*')

call DoDir (Dir)

next Dir

end sub

call DoDir ('C:')

Vikas

Highlighted
Not applicable

Re: DirList() and FileList()

I looked at it, but I do not understand it.   I need to explain it. Mainly I do not understand syntax in bracket.

Highlighted
Specialist
Specialist

Re: DirList() and FileList()

Hi,

First we define the extensions we want to look for    for each Ext in 'qvw','qvo','qvs','qvt','qvd'

Then we define the directory we want to search, in this case (Root& and then we look for anything with one of the predefined extensions (see above) '\*.'&Ext)

So in this case we would search the computer for anything with these extensions 'qvw','qvo','qvs','qvt','qvd'


Highlighted
Not applicable

Re: DirList() and FileList()

What does root mean? Where is it define?

Highlighted
Not applicable

Re: DirList() and FileList()

Can someone explain me it ?

Thanks

Highlighted
Employee
Employee

Re: DirList() and FileList()

Maybe this:

For each Ext in FileList('C:\Users\Gabika\Desktop\*.x*')

Main:

LOAD

'$(Ext)' as File

AutoGenerate (1);

Highlighted
Not applicable

Re: DirList() and FileList()

Root is just a parameter of such sub, which defines where your search will start from. When you invoke this sub, you use C:\ as root, which means you will search those files from C:\ and its sub-folders.

View solution in original post

Highlighted
Partner
Partner

Re: DirList() and FileList()

Hi.

 

My need is to read directories. I don't care a bout files this time.

Is there a DirName() function or something?

Do I have to pick up the DirName from NameFiles?

What if there is a DirName() empty?

 

Thanks