Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Get (LastError) = 500

Featured Replies

  • Newbies

I've recently converted a file from FMPro6 to FMPro7. I noticed a lot of unexpected variations in calculation results and also script procedures. On most of those, I was able to change a few things to correct the results.

But there is one that I am having trouble with.

I am using the following script to validate a correct date format entry in performing a FIND in a date field:

If (Get(LastError) = 500)

Clear(Field)

Enter Browse Mode

Show Custom Dialog ["Not a valid date format"]

End If

In FMPro6 this worked fine, but FMPro7 does not seem to recognize the Get(LastError) request. So I am stuck in the middle of a script with an invalid data entry in a date field.

Has anyone had this problem yet?

Have you tried Set Field [globalnum, Get(LastError)] to see if it may be returning a different error? Also, are you committing the request before the script continues?

  • 2 weeks later...

I have found the same problem. Rather than relearning error numbers and dealing with the changes, I just changed many of my steps from Get(LastError) = 500 (etc.) to simply Get(LastNumber) to trap any errors. For me, this was the path of least resistance.

I don't see a Set Error Capture [On] in your script. I believe you have to set this step in order to actually get the last error number.

  • 7 months later...

I use Set Error Capture [On] with CommitRecords below(did try and without).

BUT, when I make condition If (Get (LastError) = 507),

it doesnt "see" this number !?!

I made one global field where I've traped Get (LastError) and

I can see the number of Error(in my case 507).

I gave up about using function Get (LastError) for conditions...instead I use Global field - SetField[Global_Field;If(Global_Field = 507)].

Indeed, there is something "weird" with Get (LastError) function in FileMaker7.

I might be just stupid, if someone knows why, please let me know.

I use Set Error Capture [On] with CommitRecords below(did try and without).

BUT, when I make condition If (Get (LastError) = 507),

it doesnt "see" this number !?!

I made one global field where I've traped Get (LastError) and

I can see the number of Error(in my case 507).

I gave up about using function Get (LastError) for conditions...instead I use Global field - SetField[Global_Field;If(Global_Field = 507)].

Indeed, there is something "weird" with Get (LastError) function in FileMaker7.

I might be just stupid, if someone knows why, please let me know.

I use Set Error Capture [On] with CommitRecords below(did try and without).

BUT, when I make condition If (Get (LastError) = 507),

it doesnt "see" this number !?!

I made one global field where I've traped Get (LastError) and

I can see the number of Error(in my case 507).

I gave up about using function Get (LastError) for conditions...instead I use Global field - SetField[Global_Field;If(Global_Field = 507)].

Indeed, there is something "weird" with Get (LastError) function in FileMaker7.

I might be just stupid, if someone knows why, please let me know.

Get(LastError) traps the success or failure of the previous script step. So if there are other steps in there before your If, they may cause your If to show no error. So something like this won't work:

Perform Find []

# Comment Line

If [ Get(LastError) = 500 ]

Show Message [ "Whatever" ]

End If

In this case the LastError was 0 because the comment evaluates without an error. For this reason, it's a good idea to set the global right after the operation you're error trapping.

Get(LastError) traps the success or failure of the previous script step. So if there are other steps in there before your If, they may cause your If to show no error. So something like this won't work:

Perform Find []

# Comment Line

If [ Get(LastError) = 500 ]

Show Message [ "Whatever" ]

End If

In this case the LastError was 0 because the comment evaluates without an error. For this reason, it's a good idea to set the global right after the operation you're error trapping.

Get(LastError) traps the success or failure of the previous script step. So if there are other steps in there before your If, they may cause your If to show no error. So something like this won't work:

Perform Find []

# Comment Line

If [ Get(LastError) = 500 ]

Show Message [ "Whatever" ]

End If

In this case the LastError was 0 because the comment evaluates without an error. For this reason, it's a good idea to set the global right after the operation you're error trapping.

Mike,

Your're absolutly right!!!

I've never seen in my life some function like Get(LastError)...that is influented by simple comment line. Comments are there to be neutral and afford programers to make notes. It "vispers" that there is something "buggy" about function Get(LastError) when it recognizes comment as script line. Anyway, you brought solution and that is most important.

Thanks!

Mike,

Your're absolutly right!!!

I've never seen in my life some function like Get(LastError)...that is influented by simple comment line. Comments are there to be neutral and afford programers to make notes. It "vispers" that there is something "buggy" about function Get(LastError) when it recognizes comment as script line. Anyway, you brought solution and that is most important.

Thanks!

It "vispers" that there is something "buggy" about function Get(LastError) when it recognizes comment as script line.

Not necessarily so. Because ScriptMaker is interpretive, it needs to read every statement. Must admit, though, I have never been able to work out why it has to read all of a comment.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.