July 5, 200124 yr 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
July 5, 200124 yr 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.
July 5, 200124 yr Author 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
July 6, 200124 yr 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.
July 6, 200124 yr Author 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
Create an account or sign in to comment