FMMoron Posted March 13, 2006 Posted March 13, 2006 When generating a report, I have one instance where it's possible no records will be found. If this happens, they get the "records not found" message. Is it possible to skip that and show a custom message with instructions? Or maybe run a script where they can go to another layout? It's just important that they only see records that pertain to this specific layout. This is for FM 5.5 which will then be turned into a stand alone app with FM Developer. Thanks for the help. Bob
Ender Posted March 13, 2006 Posted March 13, 2006 Hi Bob, Try: Set Error Capture [ On ] Perform Find [ Restore ] If [ status ( currenterror) = 401 ] Show Message [ "No records found"; Ok ] Show All Records Go to Layout [ whatever ] Exit Script End If ...
Vaughan Posted March 13, 2006 Posted March 13, 2006 The recommended best practice is to toggle error capture on for only as long as it is needed, and put the error code into a global (or variable in FMP 8) so it can be used in later steps. Set Error Capture [ On ] Perform Find [ Restore ] Set Field [ gError, Status(CurrentError) ] Set Error Capture [ Off ] If [ gError = 401 ] Show Message [ "No records found"; Ok ] Show All Records Go to Layout [ whatever ] Exit Script End If Don't put any script steps -- not even comments -- between the step you're error trapping and the Set Field that stores the error value into the global field.
Ender Posted March 14, 2006 Posted March 14, 2006 Ho Vaughan! Indeed I use such globals to hold the last error, when necessary, and turn off the error capture when I have steps following that might generate an error (like record locking.) Most of my reports don't require these, but I'm glad you pointed them out for Bob. I've not seen that these are recommended best practices. It seems to me, if you test for the error immediately following the operation you're testing, then storing the error isn't really necessary. And if you know what your script is doing, you'll know whether or not it's important to turn off the error capture at some point. :
Vaughan Posted March 14, 2006 Posted March 14, 2006 I attended an FSA meeting last Thursday and the habit of by-default starting scripts with Allow User Abort [ off ] and Set Error Capture [ on ] was specifically described as poor practice. It appears FMI is starting to pick up on stuff like this and express opinions (and suggest alternatives). Part of this has been significant backlash by developers (and others) to the poor programming in some of the FMI-distributed templates and sample files (eg, repeating fields instead of relational, badly commented scripts).
Ender Posted March 14, 2006 Posted March 14, 2006 Having done some 'poor programming' in my own shameful past, I can appreciate the effort to provide guidance and best practices for developing in FileMaker. Hopefully, FMI would see fit to share such efforts with the greater community and not limit it to your secret FSA meetings. : I would agree that those steps in a startup script are something that I avoid. I take it the discussion of that somehow steered to the general case of how to use Set Error Capture[] and storing the error? I'd be interested in hearing those arguments as it's still is not clear to me as why they should be best practices. Anyway, it's good to hear of more guidance from FMI on development practices. As I was learning FileMaker (long ago), it was very frustrating to read the manual about some function or other, and still not know whether it was the right thing to use.
FMMoron Posted March 16, 2006 Author Posted March 16, 2006 Gentlemen, I don't post here very often, but I must say that I'm blown away by the knowledge on this forum. It really is amazing that you are willing to share (for free) what i'm sure took a long time to learn. Many Thanks! One last question. As I said, this particular solution will be a stand alone app created with Developer 5. I use FM 7 for all of my DB's normally but I only have Dev 5, so that's what I'm stuck with for this. I don't actually know what version of windows my clients will be using (most win xp but some may be using win 98). If I did upgrade to a more current version of Developer, will it work with older versions of windows? I read something a while ago that suggested there could be a problem. Also, Are there any companies/services which would convert my file with their copy of Dev 7 and are there any licensing/legal/moral problems with this? Obviously there would be a fee involved, but it might be worth it. Thanks for your input. Bob
Ender Posted March 16, 2006 Posted March 16, 2006 You can check the system requirements for FM7 and FM8 on filemaker.com, or maybe on your install CD. If you plan on maintaining clients that have a run-time version, then you had better invest in FM7 Developer (or preferrably FM8 Advanced.) There's bound to be bugs or change requests, and it's easier to deal with them yourself than to outsource every minor tweek.
FMMoron Posted March 16, 2006 Author Posted March 16, 2006 I agree with you Ender about outsourcing every minor tweak. It's just a thought. If it's reasonable enough, I was thinking it might be worth it for a future project. this is WAY too far to turn back now. Thanks again for all of your help. Bob
Recommended Posts
This topic is 6829 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