3 Replies Latest reply on Jan 8, 2011 3:45 AM by apw

    loop failure

    apw

      Title

      loop failure

      Post

      iMac, OS 10.6.6, FM 11.0v2

      I am using a loop as I've done many times before, to process some selected records.

      It looks, as always, like this:

      <some selected records>

      go to first record

      loop

      change some field

      go to next record, exit when after last record

      end loop

      The lay out is ok, the first record is correctly processed, but then it gets stuck in the first record.

      Elsewhere is runs ok.

      Anybody any idea?

        • 1. Re: loop failure
          njem

          Is there some resorting going on after the record modification?

          • 2. Re: loop failure
            philmodjunk

            Is there some resorting going on after the record modification?

            That's certainly possible with FileMaker 10 and 11.

            Were the records sorted to begin with?

            Is the field whose value was modified specified in this sort order?

            If you answered yes to both questions, then Filemaker's auto-sort feature which can't be turned off, but which can be worked around may be resorting your record set each time the change is committed when go next record takes you to the "next" record.

            If this is the case, you can unsort your records (or just don't sort them to begin with), do the loop and then sort your records after the fact.

            If this isn't the case, you may want check and see if an OnRecord Load script trigger may be firing each time go to next record takes you to the next record.

            • 3. Re: loop failure
              apw

              I figured it out; maybe it will help you.

              It turned out, that one of the fields in the sorted records had a required value which had not yet been assigned.

              So every time I opened the first record a message would normally have appeared that a value should be assigned to that field.

              However, within this loop the message remained invisible and the first record kept coming back.

              After removing the requirement for the field to have a value the loop worked as it should.