Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

creating a loop

Hi Guys,

I've read Henric's blog regarding loops.

http://community.qlik.com/blogs/qlikviewdesignblog/2013/09/02/loops-in-the-script

And I have being trying to accomplish what he is doing.

However I keep getting a error file that Qlikview can't find the file. L:\hrm_201206.qvd'

Which is correct because the file is not stored on that location. I used the Directory function, but even that didn't work.

FileListTable:

LOAD

     PersonID,

     FileName() as FileName,

     Contractnumber

FROM

(qvd);

For vFileNo = 1 to NoOfRows('FileListTable')

    Let vFileName = Peek('FileName',vFileNo-1,FileListTable);

      Load *,

                  '$(vFileName)' as FileNames

      From [$(vFileName)];

   Next vFileNo

Let vFileName= null();

What is it that i'm doing wrong?

Thanks!

iSam

2 Replies
swuehl
MVP
MVP

Not sure if I understand, have you tried FilePath() instead?

Anonymous
Not applicable
Author

Hi Stefan,

That doesn't work.

Basically I would like to achieve the below using my own files:

The most common case is that you have several files with the same structure, e.g. log files, and you want to load all of them:

   For each vFileName in Filelist ('C:\Path\*.txt')

      Load *,

         '$(vFileName)' as FileName

      From [$(vFileName)];

   Next vFileName

I have attached my script and some dummy data.

Regards,

iSam

sorry for got to attach the file. Can anyone have a look?