4 Replies Latest reply on Feb 9, 2009 4:29 PM by ralvy

    Loop with Peform Script



      Loop with Peform Script


      I have a feeling I'm missing something very obvious here. I have a script that has a loop like this:



         Perform Script

         Go To Next Record (Exit if Last)

      End Loop


      I find that the script gets stuck after finishing the subscript that's run on the first record found in the superscript. Control seems to never be returned to the superscript. Is there something I need to place at the end of the subscript to signal FM to return control to the superscript?

        • 1. Re: Loop with Peform Script
             It will depend on the context of each script. Can you give any more information about what the subscript does and where it is called from?
          • 2. Re: Loop with Peform Script

            Well, to test this out further, I made a copy of the superscript, and then pasted the subscript into the loop, making simple changes to accomodate this, and it got stuck there too. So I know now it's not my use of the Perform Script step. I'll have to debug this further before posting more here.


            Thanks, as usual.

            • 3. Re: Loop with Peform Script



              It's difficult for me to determine what may be the problem without seeing the script/file, but a common mistake (which I have made many times) is switching to a different layout that accesses different table information, and then forgetting to return to the original layout so I can proceed to the next record in the original table.


              If you are still unable to find the cause, post the subscript, and either myself or someone on the forum should be able to help you.



              FileMaker, Inc.

              • 4. Re: Loop with Peform Script
                   As it turned out, there was a problem in my subscript that had nothing to do with the loop itself. Thanks for your support, TSGal.