Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Not applicable
Author

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

9 Replies
vikasmahajan

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

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

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

morris70
Specialist
Specialist

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'


Not applicable
Author

What does root mean? Where is it define?

Not applicable
Author

Can someone explain me it ?

Thanks

Clever_Anjos
Employee
Employee

Maybe this:

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

Main:

LOAD

'$(Ext)' as File

AutoGenerate (1);

Not applicable
Author

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.

christian77
Partner - Specialist
Partner - Specialist

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

Miles_Dyson
Contributor II
Contributor II

Does anyone know a good source to learn Looping & how to use Qlik's Listing Functions. Thanks