5 Replies Latest reply on May 23, 2012 5:41 AM by Mike_Mitchell

    how to end find upon error without user interaction

    m.mcdonell

      I have to do a find search where the number of searches changes depending on the client details (this changes frequently). I figure the easiest way is to continue the find until an error appears and then end script. Unfortunately I do not want the user to have to see any of this happen.

      Any suggestions?

        • 1. Re: how to end find upon error without user interaction
          PeterWindle

          You can acheive this a number of ways, perhaps by introducing conditional (if) within a script that includes your search, or perhaps you may want to create relationships based on fields entered and then you can test on the related data. All of this may depend entirely on the criteria that you are trying to match, when you want to test the result etc... perhaps a little more info on what you're aiming for might help me give some advice, I hope this helps!?

          • 2. Re: how to end find upon error without user interaction
            FCallanan

            mcdonell,

            You don't give much detail about your needs, so here's a quick pointer towards a common direction for error capture.

            As your script opens, Set error capture[ on]. This will inhibit the FileMaker alerts.

            Then after your script performs each Find, check for errors. Something like,

            Set variable: $error= Get(lastError)

            If[$error]

              Exit Script

            End If

             

            It's a bit of a blunt instrument to simply exit the script though. You can be more helpful to your user if you Show Custom Message before exiting, or even create another script to run in the If[$error] condition. An "Error Feedback" script that tells the user what happened. You could pass the $error, which is the 401 code, to the script and interpret it for your users in a way that makes sense to their current task. Inserting the script at each error point makes it a tidier script for you as developer. Todd Geist of Geist Interacive did some very helpful work on this which you should check out.

             

            HTH,

             

            Frank Callanan

            Camden, Maine, USA

            • 3. Re: how to end find upon error without user interaction
              m.mcdonell

              Thank you Frank, I am working on a tidier solution but this will be my plan B.

              Thanks again

              Michael

              • 4. Re: how to end find upon error without user interaction
                taylorsharpe

                Well, you can use the freeze window step to freeze your window when you start the script and, upon error (using error capture), you can return to whatever layout you want and they won't see all the window changes.  Or you can do it in a small window off monitor.  For example, I'll make a 1X1 pixel window (technically it won't go that small, but you can still specify it) that is at -200 pixels (or 200 pixels to the left of the left hand margin) and do things in it and when done, return to the start window. 

                1 of 1 people found this helpful
                • 5. Re: how to end find upon error without user interaction
                  Mike_Mitchell

                  Taylor's suggestion is a good one. Not only will the user not see the interactions taking place, but the script will run faster to boot.

                   

                  Mike