3 Replies Latest reply on Jan 8, 2009 8:08 AM by TomM

    Exit loop if no records found

    TomM

      Title

      Exit loop if no records found

      Post

      How would I exit a loop in a script if no records are found?

       

      Obviously 'Exit Loop If [...]' but how do I say "no records are found"?

       

      Thanks

      Tom. 

        • 1. Re: Exit loop if no records found
          Jens Teich
             get(foundcount) = 0

          Jens
          • 2. Re: Exit loop if no records found
            TomM
              

            Jens,

             

            Thanks for that, but its not doing what I hoped for.

             

            Basically I'm looping through a group of records and substituting some information in certain fields on the first record. After each substitute I do a re-search of the records and then substitute the first one found again. So each time my found list decrements by 1. Eventually, after the last one, the found list will be zero and I want my script to exit the Loop without any dialogs.

             

            At the moment I see the FileMaker dialog saying "no records match...", and my loop DOES exit. But can I hide this dialog, end the loop and then continue with the rest of the script all hidden from the user?

             

            Thanks for you help!

            Tom. 

            • 3. Re: Exit loop if no records found
              TomM
                

              Its ok, fixed it with 'Set Error Capture [On]'

               

              Thanks for your help.

              Tom.