Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Community,
Is it possible to use Qlikview to scan a folder where we have different files
like A-xxxx, A-yyyyy, B-zzzzz
I'd like in the load script to only read and process the most recent A- or B- file
By most recent I mean the greater number after A- or B- or C- etc...
By doing that I'd also like the most recent files to be moved in a different folder then be loaded in Qlik while the file that have not been read moved to another file.
I have no clue how to start on this question so any help would be great.
Enclosed is a zip containing an examples of files and architecture of the folder I use
In advance thank you for your help.
You could use a dirlist/filelist loop to get all files with a certain name-pattern and within the loop you could further check parts of it and/or using them within file-functions like filetime(). Here an example which just checked if the name-part is bigger as the default value but it shouldn't be too difficult to adapt it to your requirement:
for each vFile in filelist('$(pApp@L11@QVD)Rawdata_*.qvd')
if subfield(subfield('$(vFile)', '.', -2), '_', -1) >= 201901 then
Rawdata: load * FROM [$(vFile)] (qvd);
end if
next
In your case you may not load the data within the loop else just using it to store the latest file-name and so on within variables which are then used to load and move the files. For moving the files you could use EXECUTE to start a cmd which moves/copies the files - an example could you find here: EXECUTE-command-to-move-files-listed-in-an-XLSX-or-TXT.
- Marcus