Garry Claridge Posted July 5, 2001 Posted July 5, 2001 Does anybody know how to capture the 'No Records' alert returned from FMP. Rather than have the alert displayed, we want to perform other actions on this condition. Thanks. Garry
Vaughan Posted July 5, 2001 Posted July 5, 2001 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.
LiveOak Posted July 5, 2001 Posted July 5, 2001 Set Error Capture (on) traps errors and suppresses error messages. -bd
Garry Claridge Posted July 5, 2001 Author Posted July 5, 2001 Thank you Vaughan and -bd. I was actually asking about the CDML tags. However, we just discovered that "-err" is not the same as "-error", in fact "-err" does nothing. I have been using "-err" since I started CDML in Feb this year. Thank you. Garry
Vaughan Posted July 6, 2001 Posted July 6, 2001 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.
Garry Claridge Posted July 6, 2001 Author Posted July 6, 2001 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
Recommended Posts
This topic is 8610 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