1 Reply Latest reply: Jan 9, 2017 7:58 AM by Sunny Talwar RSS

    3 questions about Loops for a beginner. Please help me answer :)

    John Blomqvist



      I read this blog post: Loops in the Script


      Here is an example of a Loop from the above blog:


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

            Load *,

               '$(vFileName)' as FileName

            From [$(vFileName)];

         Next vFileName


      I do not understand the following about the above loop statement:


      1) Is vFileName an in-built variable? I didn't have to declare it as a SET or LET statement prior so wondering how this works.


      2) How does vFileName carry the path and the file name? It seems to work in combination with Filelist function above but I do not understand how.


      3) Does the LOAD statement load one at a time? E.g. If I had a folder with 4 files, is this Loop running four times thus the LOAD statement load one file at a time?