
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Loading Files to QVD
Hi I have 20 files named in the Accounts Folder, of which 10 are AccountsPayable with date appended to the files for each month rest are miscellaneous that i will not need . the accounts payable file have the same number of columns are field headers. I want to load these 10 files into my app . But how ever the accounts payable file names end with the month name appended to it. eg File 1: AP_112021, File 2 : AP_102021 File 3: AP_092021... so on. I wont be able to create a new folder to have this file separately. all file should be accessed from this folder. The field names are Account number, dept, vendor, invoice details . Each month the files will be placed under this folder, which should also be processed by QLik once the files are there
Is there a way i could load all the AP files through the data load editor, even if the new files comes each month , with having to change the load editor script each month

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can use the wildcard * to load files that begin with certain text.
Example:
Load Column1, Column2 .. from [lib://Connection/AP_*] ;
This would load all files that start with "AP_" .
They need to have the same structure if you define the columns (so they will automatically concatenate).
Regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While @Gui_Approbato script does what was requested, it has a few weak points. Firstly, if the load fails, it won't tell you which QVD file is causing the issue. This can be avoided by not using the star wildcard during the load, and instead wrap the load in a for each filelist loop. Secondly, natural concatenation is nice when it works, but a pain when something unexpectedly breaks it. Using explicit concatenation is a far more robust approach.
So something like this is what I'd suggest:
for each vL.QVD in FileList('$(vL.FolderPath)AP_*.qvd')
trace >>>>>: $(vL.QVD);
if Alt(NoOfRows('AccountsPayable'), 0) = 0 then
NOCONCATENATE
AccountsPayable:
LOAD
Field1,
Field2,
Field3
FROM
[$(vL.QVD)] (qvd);
else
CONCATENATE(AccountsPayable)
LOAD
Field1,
Field2,
Field3
FROM
[$(vL.QVD)] (qvd);
end if
let vL.QVD = ;
next
