9 Replies Latest reply on Mar 1, 2012 9:42 AM by vince.menanno

    Go to Record bug?

    DavidJondreau

      Has anyone else encountered an issue with Go to Record (Next/Previous) exiting a script?

       

      When Go to Record next or previous script step with the "Exit after last" option checked is used in a script ( but not in a Loop ), it exits the script, despite what the help file says.

       

      I've attached a file with two scripts. Running the script should produce a Custom Dialog, but I get an exit instead.

        • 1. Re: Go to Record bug?
          datastride

          David,

           

           

           

          Why do you have the boxed label “Exit after last” checked when you are not in a loop?

           

           

           

          Peace, love & brown rice,

           

          Morgan Jones

           

           

           

          FileMaker + Web:  Design, Develop & Deploy

           

          Certifications: FileMaker 9, 10 & 11

           

          <http://www.onepartharmony.com/> One Part Harmony 

           

          Austin, Texas • USA

           

          512-422-0611

          • 2. Re: Go to Record bug?
            DavidJondreau

            Morgan,

            So you can confirm you're seeing the same behavior?

             

            According to the help file it shouldn't make a difference, so I never ensured it was checked or not.

             

            http://www.filemaker.com/11help/html/scripts_ref1.36.19.html "Note Exit after last will exit a loop but does not stop or exit a script."

             

            Now I've got to double check any script that uses the script step and make sure that box isn't checked.

            • 3. Re: Go to Record bug?
              Stephen Huston

              I have to second Morgan's query.

               

              I can also make scripts misperform by  using an inappropriate step at the wrong place, but the whole point of good scripting is to not to do that.

               

              I can't recall every choosing Exit After Last outside of a loop because that's what its for, exiting loops. That it has undocumented consequences if invoked elsewhere is not really unexpected behavior, though worth knowing.

              • 4. Re: Go to Record bug?
                jormond

                David,

                When I look at that link, it reads "Exit after last tells FileMaker Pro to exit the script or control structure (like a loop) when it reaches the last record in the found set."

                • 5. Re: Go to Record bug?
                  DavidJondreau

                  Huh, the help file contradicts itself. I had skipped ahead to the Note, that explicitly says something different...Certainly something worth keeping an eye on.

                   

                  "

                   

                   

                  Previous moves to the previous record in the file or found set, displays the previous find request, or moves to the previous page in a report. Exit after last tells FileMaker Pro to stop the script when it reaches the last record in the found set. You can use Exit after last with the Loop script step to exit out of a loop after the last record.

                   

                   

                  Next moves to the next record in the file or found set, displays the next find request, or moves to the next page in a report. Exit after last tells FileMaker Pro to exit the script or control structure (like a loop) when it reaches the last record in the found set.

                   

                   

                  By Calculation lets you create a calculation to determine the index number for the desired record, find request, or page in Preview mode.

                  Note  Exit after last will exit a loop but does not stop or exit a script."

                  • 6. Re: Go to Record bug?
                    jormond

                    Yeah...I've been caught by stuff like that before.  I'm just glad I don't have to maintain their documentation.

                     

                    Others that I've caught I sent in as a bug...for the documentation. lol

                    • 7. Re: Go to Record bug?
                      BruceRobertson

                      And get(lastError) in the calling script returns the usual error for going to last record (101).

                      • 8. Re: Go to Record bug?

                        Hi David!

                         

                        We need to be able to trust the documentation literally and the portions you quoted clearly contradict, clearly ...


                        "Note 
                        Exit after last will exit a loop but does not stop or exit a script."

                         

                        I would send it in as a documentation error as well. Thank you very much for being willing to bring it to light. 

                        • 9. Re: Go to Record bug?
                          vince.menanno

                          David,

                           

                          If your file you have 2 scripts.

                           

                          The first one takes you to the first record and then you try to go back one more by saying go to previous. So it exits because the 1st record is in a sense the last record before you try to go to the one before it.

                           

                          The second script is more typical... it goes to the last record and seeing as you ARE on the last record then trying to go to the next record will also exit right there on the spot and throw that lovely error.

                           

                          One thing we like doing is turning on Pause on error and be notified with the debugger when we actually hit a real error.

                           

                          loop exit example.png

                           

                          Vince