2 Replies Latest reply: Mar 11, 2014 9:02 AM by Michael Solomovich RSS

    For each + autogenerate + while gives .... -1, ....-2 tables

    Michiel van de Goor

      I have the following statement:

       

      let aantal_te_loggen = NoOfRows('To_log');

      for  loggen = 0 to NoOfRows('To_log')

      let bestand_to_log = peek('bestand',loggen,'To_log');

       

      Logbestand:

      load  '$(bestand_to_log)' as Bestand,

        filetime('$(bestand_to_log)') as '$(bestand_to_log)'

      AutoGenerate (1)

      while 0 + IterNo( )-1 <= '$(aantal_te_loggen)';

       

      next loggen

       

       

      This should generate 1 table with the filename and the filetime based on a inline table with those filenames.

       

      I do not get all results. I only get the second line from the inline table and for each  line a table with Logbestand-1, Logbestand-2 etc. etc.

       

      What am I doing wrong?

        • Re: For each + autogenerate + while gives .... -1, ....-2 tables

          Michiel,

           

           

          let aantal_te_loggen= NoOfRows('To_log');

          for loggen= 0 to NoOfRows('To_log')-1

          let bestand_to_log= peek('bestand',loggen,'To_log');

          Logbestand:

          load '$(bestand_to_log)' asBestand,
          filetime('$(bestand_to_log)') as FileTime


          AutoGenerate (1)
          // while 0 + IterNo( )-1 <= '$(aantal_te_loggen)'

          ;

          next loggen


          NoOfRows -1 (because the start is 0)

          as FileTime: to get a unique field name and get a unique table

          //while (if you do not use iterNo(), why do you need to loop ?)

           

          Hope this helps

           

          Fabrice

          • Re: For each + autogenerate + while gives .... -1, ....-2 tables
            Michael Solomovich

            The tables in the loop have different structure, hence they don't collapse into one table.  What about this.

             

            let aantal_te_loggen = NoOfRows('To_log');

            Logbestand:
            LOAD * INLINE [
            Bestand];


            for  loggen = 0 to NoOfRows('To_log')

            let bestand_to_log = peek('bestand',loggen,'To_log');


            CONCATENATE (Logbestand)

            load  '$(bestand_to_log)' as Bestand,

              filetime('$(bestand_to_log)') as '$(bestand_to_log)'

            AutoGenerate (1)

            while 0 + IterNo( )-1 <= '$(aantal_te_loggen)';


            next loggen