
Loading all QVD’s in a folder
Sometimes short articles are the best. You don’t need lots of time to get a nice idea or concept.
Do you want to load multiple QVD’s from a folder?
Here is the code:
Set vFolder = '.'; FOR each File in filelist(vFolder& '\*.qvd') LOAD * FROM [$(File)] (qvd); NEXT File
For a more simple solution to this problem you could also use:
LOAD * FROM .\*.qvd (qvd);
Hope this helps you guys a bit.
I don’t see why the For Each is required in your example. Why not just a single simple statement:
LOAD * FROM .\*.qvd (qvd);
You are right Rob. Thanks for pointing out. I’ll add it to the original post.
Hello Patrick, we are trying to load into QlikView several QVD’s into one table, using that approach. However, there is the possibility that in the future the user might want to add columns, so the newer QVD’s would have these additional columns. We don’t want to recreate the older QVD’s, what we want to do is to load the newer QVD’s and the older QVD’s and make it in a way that the new column is left blank for the older ones. Also, we do not know what these columns are going to be, if they in fact are added. We just want to have a script that is prepared to handle that scenario, even if it is not 100% sure it will happen. Is it possible?
Eduardo,
I think that it is possible. If you first load in the tables’ fieldnames and assign a rownumber to it, you could then, after that, add those fields to the @ of the field that gets loaded by loading the table.
Let me know…
Wondering will these two approaches perform the same in loading data?
I cannot think of any other way to differentiate the performance when qlikview eventually executes these two commands, maybe the loop one is slightly slower, I guess.
For me, one advantage of using “for each” loop is that filenames are stored in log file. When you use “load *”, and your script encounters a bad file then you don’t know which file is being loaded and is giving you trouble…