5 Replies Latest reply on Sep 14, 2016 8:46 AM by David Moyer

    Get (LastError)


      Using FM15 (on pc)


      Problem with this function in a script:

      Table 1 related to Table 2 (1 to many)


      Script as follows does NOT work (it always selects as true even if error code is 101)

      If(Get(LastError)) = 0

      show custom dialogue1


      show different dialogue2



      Script as follows does WORK

      Set variable($le = Get(LastError))

      If($le) = 0

      show custom dialogue1


      show different dialogue2



      This does not make any sense.

        • 1. Re: Get (LastError)

          this is not community feedback but a Discussion question. You may move this to a space where more users will see it or @TSGal or @TSPigeon can help you move it.



          • 2. Re: Get (LastError)



            Thank you for your post!


            As beverly mentioned this post may be better suited for Discussions or Report a Product Issue  as this does not relate to an issue or question about the FileMaker Community itself. I will move it do Discussions so you might receive further views and advice.


            I was unable to reproduce this issue with FileMaker Pro 15 (Advanced) on Mac OS X or the Windows Operating System. To attempt to reproduce I followed these steps:

            1. Created test.fmp12

            2. Created "Script"

                 Set Error Capture [On]

                 GoToRecord/Request/Page [With Dialog: Off ; "2"]

                 If [Get(LastError) = "0"]

                      Show Custom Dialog [ "Last Error was 0" ]


                      Show Customer Dialog [ "Last Error was" & Get(LastError) ]

                 End If

            3. Ran Script with less than 2 records and received the Dialog "Last Error was 101"

            4. Ran Script with 2 records and received the dialog "Last Error was 0"


            The script seems to work as expected in my sample. Let me know if you have further steps necessary to reproduce.


            Are you able to replicate this in a new file?



            FileMaker, Inc.

            • 3. Re: Get (LastError)

              It looks like the key information needed to diagnose this is not shown. What script steps precede Get ( LastError ) in your script?


              In general terms, Get ( LastError ) has to be used immediately after the script step that produced the error. We often set a variable to that value when we need to do something with that error code at least one more script step later in the script and thus it is retained in the variable.

              • 4. Re: Get (LastError)



                I know it will sound obvious, but make 100% sure that there is no script steps between the step that gives the error code and the if statement.

                Hope this helps



                • 5. Re: Get (LastError)
                  David Moyer

                  smfdist wrote:



                  If($le) = 0

                  show custom dialogue1




                  I know this is pseudo-code, but to make sure, the clause, in pseudo-code, should be

                  ($le = 0) and (Get(LastError) = 0)

                  Also, for convenience, please see my function for quick interpretation of the error code you get:

                  Get(LastError) Custom Function