1 Reply Latest reply: Mar 13, 2014 9:56 AM by Friedrich Hofmann RSS

    LOOP - what governs whether or not a table is appended?

    Friedrich Hofmann


      Hi,

       

      I have a strange phenomenon:

      - I have a LOOP construct in one of my apps where I want to extract (RESIDENT) monthly values from a table for all the "completed"
          months (in this instance Jan and Feb).

      => My problem is this: I have tried this both ways

           - DO ... LOOP

           - FOR .... NEXT

      Whichever way I do it, in this LOOP, the table I create gets overwritten:

      => The table gets created with 1 record

      => The variable gets increased like it should (I can see in the log that there are 2 iterations and the variable is increased
            and a filter (for >> num(month([date])) = $(i) <<) is updated accordingly

      <=> Still, I end up with a table that has only 1 record (should be 2) and the month (that is what the counter i actually means) is 'Jan'.

      <=> I have a similar LOOP (FOR ... NEXT) in another app (from 1 to 12) where this works: Upon every iteration, 1 record is appended
              to the table and I end up with a table that has 12 records.

       

      Does anybody have an idea what can be the cause for this working or not working?

      Thanks a lot!

      Best regards,

       

      DataNibbler

        • Re: LOOP - what governs whether or not a table is appended?
          Friedrich Hofmann

          OK,

           

          I have finally got my brain around this.

          There was definitely something quirky about this, but

          => basically, the issue was that in one of the two months in question, there were no records matching all of my WHERE_clauses - so nothing was loaded in that iteration of the loop.

          => I fixed this now by building a "failsafe" - a dummy_record to be loaded when that happens so that I'll have something to work on.

          Consider this done.

          Best regards,

           

          DataNibbler