Jump to content

Error Capture - Need Help


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

Recommended Posts

Okay, I'm trying to make my software more user friendly. I have a report I want the user to be able to print or export. I present a dialog, they choose, all is good.

Once I go to export, I want to export to a path stored in another table. So, I create a variable called $EXPORTNAME, then insert the path and a filename into the variable.

Here's what I would like to see happen:

User clicks export from the dialog. Software attempts to save to $EXPORTNAME (which contains the full path and filename) using the specify output file option in the export script step.

If software gets an error, like if the path is bad or the destination is read only for the user, then it tries to export again using a script step where the output file option is NOT checked, that way the user will be prompted with a dialog to choose a location and file name.

My code looks like:

Go To Layout ["Weekly_Report"]

Sort Records [Restore; No dialog]

Set Error Capture [On]

Export Records [No dialog; "$EXPORTNAME";Macintosh]

If [Get ( Last Error ) = 0]

  Export Records [No dialog; Macintosh]

End if

Problem is, it doesn't capture the error. I purposely set my path to try to write to a read only folder, and FileMaker generated and displayed the error, even though I had Set Error Capture to On. The error I got reads, "Weekly_Payroll_Report_382011.txt” could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk."

Not only that, it doesn't even recognize an error has occurred and run the second export script step!

I'm sure I'm missing something silly, but I sure could use some help here.

I used 0 as my error code because that's what it returned in a test I did. I've tried it with no number at all, but it still doesn't capture the error.

Link to comment
Share on other sites

Alas, you cannot suppress the error message:

http://help.filemaker.com/app/answers/detail/a_id/5954/kw/error%20capture%20export/session/L3NpZC9TcEFFWXJvaw%3D%3D

As for capturing the error, this seems to be a quirk of version 9 and earlier; try something like:

Set Error Capture [On]

Export Records [No dialog; "$EXPORTNAME";Macintosh]

Set Variable [ $e ; Get ( Last Error ) ]

If [ $e ]

Export Records []

End if

You should be getting error number 800. Note that error 0 is no error.

Link to comment
Share on other sites

This is sort of what I had feared. I'll try capturing the error into a variable as you suggested. You mention it's a quirk of version 9 and earlier, but I'm now up to version 11 advanced and still getting the error. :(

So error 0 is no error...well I guess I learn something new every day. Thank you!

If I leave it as:

If ( Get ( Last Error ))

Export Records []

End if

Would that always execute since it would return a value either way?

Link to comment
Share on other sites

Would that always execute

No, because 0 evaluates as False.

You mention it's a quirk of version 9 and earlier, but I'm now up to version 11 advanced and still getting the error.

The quirk is only in the If ( Get ( LastError ) = ... ) part. In the older versions, the error was cleared before the If[] step could evaluate it. This was fixed in v.10.

Link to comment
Share on other sites

This topic is 4352 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.