July 31, 200421 yr 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?
August 2, 200421 yr 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?
August 12, 200421 yr 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.
August 17, 200421 yr 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.
March 18, 200520 yr 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.
March 18, 200520 yr 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.
March 18, 200520 yr 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.
March 18, 200520 yr 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.
March 18, 200520 yr 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.
March 18, 200520 yr 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.
March 21, 200520 yr 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!
March 21, 200520 yr 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!
March 22, 200520 yr 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