2 Replies Latest reply: Dec 15, 2014 8:44 AM by Ira G RSS

    For each loop while add load

      Hi everybody

       

      I have studied the related topics to my Theme, but still don't have a clear answer for my question. Is it possible to make the for each loop work, if you have add load?

       

      I have something like this:

       

      let var = file1, file2, file3

       

      for each file in $(var)

      tabletemp:

      add load *

      FROM $(var);

       

      ...

       

      Wish you a nice day!

        • Re: For each loop while add load
          Peter Cammaert

          This will be concatenated to the same table automatically by a QlikView phenomenon called ... AutoConcatenate. When the next LOAD detects a similar table layout as the last one, the new data will be concatenated to the resident table.

           

          BTW to make it work, drop the add keyword, change FROM $(var) into FROM $(file) and add a NEXT keyword to the end

           

          However, there may be situations where this trick refuses to work (I got a couple of cases that were very RAM-dependent, and some may have been hampered by other things in QlikView not working altogether well)). To make sure that it works under all circumstanctes, you can force concatenation by using a $-sign expansion variable, like in:

           

          LET var = 'file1', 'file2', 'file3'

          LET vPrefix = 'tabletemp:';

           

          FOR EACH file IN $(var)

            $(vPrefix)

            LOAD *

            FROM $(var);

            LET vPrefix = 'CONCATENATE (tabletemp)';

          NEXT

           

          The syntax checker will go crazy on the free variable. Don't worry, it'll still work out ok.

           

          Peter

            • Re: For each loop while add load

              thank you for the answer, Peter!   sorry for mistakes... I thought that when we use partial reload, we need to add ADD before loading -> add load, otherwise it won't work? My problem is that when I use partial reload, only first document from $(var) is opened but not the other two...