Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i want to load always all tables from a directory, even if there new tables or tables were deleted.
This is an example for a folder structure:
MainFolder
SubFolderr1
File1
File2
SubFolder2
File3
File4
SubFolder3
File5
File6
How can i load always all tables from MainFolder regardless of new filename´s or files wich were deleted?
regards,
Fritz
Walter,
maybe something like
sub DoDir (Root)
for each Ext in 'qvw', 'qva', 'qvo', 'qvs', 'qvc', 'qvd'
for each File in filelist (Root&'\*.' &Ext)
FileLoad:
LOAD
'$(File)' as Name,
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
trace Loading file $(Dir)/$(File) ;
LOAD * FROM [$(File)] (qvd);
next File
next Ext
for each Dir in dirlist (Root&'\*' )
call DoDir (Dir)
next Dir
end sub
call DoDir ('C:\tmp\QVD');
sample model....
Take a look at Rob's QlikView Components : GitHub - RobWunderlich/Qlikview-Components: A library for common Qlikview Scripting tasks
a call to the sub Qvc.ListFiles will do the job.
Hth,
Michael
loop through to load all files from a folder and its subfolders?
HTH
Vikas
i can´t find "filelist" in the documenation https://help.qlik.com/de-DE/sense/1.1/Subsystems/Hub/Content/Scripting/FileFunctions/FileFunctionsIn...
I´m working with Qlik Sense for Desktop. Is this ok or an error?
Must i use an alternative command?
Because the script doesn´t run the red code:
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') ;
regards,
René
It can be caused by the FileExtension variable.
Try
for each FoundFile in filelist( Root & '\*.' & '$(FileExtension)')
instead of
for each FoundFile in filelist( Root & '\*.' & FileExtension)
or for each FoundFile in filelist( Root & '\*.csv')
G.
I found the solution:
For security reasons, Qlik Sense in standard mode does not support absolute or relative paths in the data load script or functions and variables that expose the file system.
However, since absolute and relative paths were supported in QlikView, it is possible to disable standard mode and use legacy mode in order to reuse QlikView load scripts.
https://help.qlik.com/en-US/sense/1.1/Subsystems/Hub/Content/LoadData/DisableStandardMode.htm
regards,
René
Oh yes, I didn't noticed the absolute path.
Create a lib connection to that directory, and will work.
G.
How can i create a lib connection to that directory?
I got an error now
regards,
René