Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all. I have a folder with a number of files in it. I would like to load the list of files in that folder into a table in QlikView. This list changes frequently, so I'd like to run some function where I pass it the file path and it dynamically generates the list of files in that folder, perhaps with a filter for the extension. Is there a function to do this? Thanks!
Hi
I think its helps
Sub loadfiles(Files)
For Each file in FileList('$(Files)' & '\*.*');
LOAD '$(file)' AS FilePath,
if(Len(SubField('$(file)','.',-1)) < 8,SubField('$(file)','.',-1),'No Extension') AS FileExtension,
FileSize('$(file)') AS FileSize,FileName('$(file)') As FileName,
FileTime('$(file)') AS FileTime AutoGenerate 1;
NEXT file;
For Each subdir in DirList('$(Files)' & '\*');
CALL subFunction('$(subdir)')
NEXT subdir;
End Sub
SUB subFunction(Subdir)
For Each sub in DirList('$(Subdir)')
CALL loadfiles('$(sub)')
NEXT sub;
End Sub
Call loadfiles('E:\Qlikview -11')
Hey! Very cool! Thanks a lot for that code. One thing though, it seems to work perfectly, except the FileName field comes up empty. Does it do the same for you? I'm running QV11 SR1.
hi
Try like this for FileName:
SubField('$(file)','\',SubStringCount('$(file)','\')+1) As FileName
Its give the result