Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to load from qvd in a loop

Can anyone show me how I would create a loop where I am loading from qvd when the qvd's are named with a date?

3 Replies
Nicole-Smith

You don't even need a loop--you can use an asterisk.

For example, say you have files named File_06-26-2014.csv and File_06-27-2014.csv.  You can simply do:

Table:

LOAD *

FROM File_*.csv;

And it will load in both of them.

Not applicable
Author

Hi,

If Qvd's name are something like this: MyFile_06152014.qvd, MyFile_06162014.qvd, MyFile_06172014.qvd... or something like this: MyFile_042014.qvd, MyFile_052014.qvd, MyFile_062014.qvd, you can try a "comodin" load:

MyFactTable:

Load

     *

From MyFile_*.qvd (qvd);

And thats all.

regards.

hic
Former Employee
Former Employee

Loading using a wildcard works, but it is not as flexible as if you use a real loop. For instance, Preceding Load cannot be combined with a wildcard load. So instead I suggest...

For each vFIle in FileList('C:\Path\File*.qvd')

     Load

          '$(vFile)' as FileName,

          *

          From [$(vFile)] (qvd);

Next vFile

You can also extract the date using e.g.

     Subfield('$(vFile)','_',2) as Date

HIC