Jump to content

#Comment Interferes with Script - Bug?


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

Recommended Posts

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

This topic is 6706 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.