Jump to content

No Records Alert Capture


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

Recommended Posts

Just before the Perform Find step, insert the Set Error Capture [ON] step. Or it may be [Off] -- I can never remember whether ON disables FMP's error capture, or enables it!

The error capture step will disable all FMP error messages. Just be careful, because now YOU are responsible for trapping errors. I'd be very cautious following a find with a delete found set step -- check that the whole database isn't found before deleting anything.

If you want to actually capture the error code itself then it's a bit trickier. Still use the set error capture step before perform the find (or whatever). Then you'll need a global field and use a Set Field [gfield=Status(CurrentError)] step immediately after the find (or whatever) to remember the error code, then use the value from the global field later in the script.

If you can put the script step that uses the error code immediately after the find (or whatever) step then you don't need the global field and set field step.

Link to comment
Share on other sites

Well in that case, specify an error format file using the -error CDML tag. In the error html format file...

[FMP-If: currenterror=401]

Stuff that should be displayed if no records are found: exactly what depends on the situation. In a forum I've made, the error page is a copy of the main forum list except where the messages would appear it says "no messages" and the form for posting is underneath.

[/FMP-If]

Note carefully: if the error page is returned it means that the action failed (this is not necessrily a bad thing). What is important is that Web Companion cannot return any record-dependent information (fields, even global fields) because it has no found records.

If you want to "trap" for more than one error condition you can include more than one If on the error page. I usually use if/else and nest them, with at least one else containing a generic message to display for unexpected unspecified errors.

Link to comment
Share on other sites

Thanks Vaughan. We are using -errnum=401 in conjunction with [FMP-If: CurrentError=401] and all is well. It was the dreaded -err instead of -error which caused our grief.

The other advice for scripts capturing error messages, from you and -bd, is also very valuable.

Thank you.

Garry

Link to comment
Share on other sites

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