Newbies automator Posted July 31, 2004 Newbies Posted July 31, 2004 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?
-Queue- Posted August 2, 2004 Posted August 2, 2004 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?
FMDuck Posted August 12, 2004 Posted August 12, 2004 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.
Walter B Posted August 17, 2004 Posted August 17, 2004 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.
stash Posted March 18, 2005 Posted March 18, 2005 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.
stash Posted March 18, 2005 Posted March 18, 2005 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.
stash Posted March 18, 2005 Posted March 18, 2005 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.
Ender Posted March 18, 2005 Posted March 18, 2005 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.
Ender Posted March 18, 2005 Posted March 18, 2005 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.
Ender Posted March 18, 2005 Posted March 18, 2005 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.
stash Posted March 21, 2005 Posted March 21, 2005 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!
stash Posted March 21, 2005 Posted March 21, 2005 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!
Oldfogey Posted March 22, 2005 Posted March 22, 2005 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.
Recommended Posts
This topic is 7185 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 accountSign in
Already have an account? Sign in here.
Sign In Now