Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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.
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.
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