July 24, 200223 yr 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.
July 24, 200223 yr 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.
July 24, 200223 yr 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.
July 24, 200223 yr 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.
July 24, 200223 yr 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.
July 24, 200223 yr 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
July 25, 200223 yr Author That would be nice indeed! I remember "rem" and putting a ";" in the win.ini!
Create an account or sign in to comment