Jump to content

Get (LastError) = 500


This topic is 6999 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 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.

Link to comment
Share on other sites

  • 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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 6999 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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