Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Walter,
Check this out:
Set vConcatenate = ;
sub ScanFolder(Root)
for each FileExtension in 'csv'
for each FoundFile in filelist( Root & '\*.' & FileExtension)
FileList:
$(vConcatenate)
LOAD *, '$(FoundFile)' as SourceFile
FROM [$(FoundFile)] (txt, codepage is 1252, embedded labels, delimiter is ',', msq, header is 2 lines);
Set vConcatenate = Concatenate;
next FoundFile
next FileExtension
for each SubDirectory in dirlist( Root & '\*' )
call ScanFolder(SubDirectory)
next SubDirectory
end sub
Call ScanFolder('C:\Users\hic\Documents\2012\Work\QV Apps\DoDir') ;
loop through to load all files from a folder and its subfolders?
Thanks,
Sangram.
Hi Sangram,
there is an error for "FileList". I can´t find "FileList" in the documentation https://help.qlik.com/de-DE/sense/1.1/Subsystems/Hub/Content/Scripting/FileFunctions/FileFunctionsIn...
Is this only for Qlikview? I´m using Qlik Sense.
regards,
René
Hi Walter,
What is the error message?
G.
The FileList expression could be reserved. Have you tried other tablename?
Mhhh, there is no error message, it´s only red.
It could be caused by the $(vConcatenate) expansion below. It may just be the syntax checker and may not be a real error. Using variables like this also breaks the QV scruipt editor syntax check, but they run normally in spite of the error indicated in the syntax check.
It's strange. Doesn't say the data load editor anything, only error occured?
--
I think you can make it more easier that code, so easier to debug.
I would omit the second for each about file extension, and change the filelist( Root & '\*.' & FileExtension) to filelist( Root & '\*.csv), or add if
if right('$(File)',3)='csv' then
Load ....
end
G.