trevorg Posted July 24, 2002 Posted July 24, 2002 Hi Everyone, I just ran into an unexpected behavior. I had the following simple script: (Condensed for typing sake) Set Error Capture ON Loop Set Field (some data in the record) Go To Record/Request/Page[Exit after last, Next] #Look for records that fail required value validations IF[status(CurrentError) = 509] #Must revert the record to allow the script to continue. Revert Record/Request [No dialogue] End If End Loop Using Developer 5.5 and the Debug Script mode, when stepping through each Script Step FileMaker fails to capture the 509 error because the comment is in-between the action that causes the error and the IF that catches the error. If I move the comment out from in-between the two, it does capture the error. Wow. A comment shouldn't mess up a script.
RussBaker Posted July 24, 2002 Posted July 24, 2002 Yep, I agree - but FMP doesn't hold on to the generated error code for more than the next step, so its important to place your If[status(CurrentError)] step immediately after the action which could case the error. If you don't want to do this, then you should store the error number in a global field and then check for it in a later script step by running the If step on the contents of the global field.
SteveB Posted July 24, 2002 Posted July 24, 2002 Trevorg is right...only the very lame-brained would execute a comment line in a debugger. I have never seen that done in any language/compiler environment (over 30 year of experience). Comments are universally ignored by the compiler or interpreter.
Kurt Knippel Posted July 24, 2002 Posted July 24, 2002 It is not so much that the comment is executed or that the debugger forgets the error code, it is that EVERY SINGLE SCRIPT STEP sets the error code. And there is only 1 error code register available to the Status ( CurrentError ) command. So the error code from the Find Script is valid only until the next line where another error code is set. If you want to make the error code more persistant then use a global field. Personally I use global repeating fields for storing error codes. I then have a layout which shows them all as well as what each of them stores. This way I can see error results from my last find, import, export, sort, or whatever other function I want.
SteveB Posted July 24, 2002 Posted July 24, 2002 Kurt: What you say is certainly true . My point is that a comment is not and should not be an executable script step. In fact, a nice change would be for them to let us put a # in front of any line to prevent its execution, rather than having to move the statement to the bottom of the script following an Exit or Halt or deleting the statement.
Jack Posted July 24, 2002 Posted July 24, 2002 I would love to have the ability to put a "#" in front of a step to prevent it from executing. Kinda like the "rem" in DOS- for those you old enough to remember.... Jack
trevorg Posted July 25, 2002 Author Posted July 25, 2002 That would be nice indeed! I remember "rem" and putting a ";" in the win.ini!
Recommended Posts
This topic is 8524 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