Thanks for accepting me into the group :) and
thumbs up for Modular FileMaker - great concept! Thumbs down and death be to all (unnecessary) dependencies!
(more praise, more praise, more praise…however...)
I've found a programming bug in the Propa-Gator module that you may wish to clear up - and, because it seems to be an error in the script parameter parsing code it may well be in all modules.
"An error in the script parameter parsing code?" I hear you say? "No way! It has been tried and tested 1000 times."
Indeed - and the parsing code is great - no problem there, … yet nevertheless a pervasive bug has … or will … slither into the code and bite you.
It is a good old FileMaker Gotcha that has got you this time!
It is none less than the Get( ScriptResult ) problem (you know it already?) caused by multiple script-exit-strategies in the script, some which return a parameter, and some that don't.
The script in the pic, CreateRecord, looks as if it is designed to return an error value, that you can check in the calling script to see if everything worked. - Nice. Like it.
….HOWEVER … should the calling script have managed to botch its parameter-passing, this will cause a parsing error and the CreateRecord script exits (at line 14) WITH NO RESULT PARAMETER. This, as you probably know, causes FileMaker to NOT SET the Get( ScriptResult ) value (one of those Very Strange FileMakery Behaviours that make us love and hate our tool the way we do), which in turn means the attempted check of the ScriptResult in the calling script ACTUALLY returns the result of the PREVIOUS (successful) SCRIPT CALL - what, where and whenever that may have been.
In other words after returning from this (or any such) script the Get( ScriptResult ) function in the calling script is USELESS*.
Thanks for the cool stuff again, and I hope this helps to catch the bug before it bites too many poor innocent unsuspecting developers. :-)
Greetings from Germany
Russell Watson (aka MrWatson)
* Well, not quite: You *could* call a script which always returns an empty string before calling the CreateRecord script….but in the long run it'll probably lead to better, more readable code if you (Proposal 1:) define a standard result/error code that can be returned when the parameter parsing fails.**
** (Proposal 2:) HOWEVER, if a script returns NO ScriptResult, then the exit-on-parsing-error should also return NO ScriptResult***
*** (Proposal 3:) This tricky reality of FileMaker programming needs to be communicated to users of mFileMaker
P.S. If you like the script colors and line numbers in the script editor pic, note it is NOT an illustrator touch up job,Line but the real thing in the FileMaker Script Editor - just:
1. Get a mac
2. Get the MBS Plugin from monkeybread software
3. Get the cool tool fmSyntaxColorizer (or its big brother fmWorkMate) from
www.fmworkmate.com (i.e. from me)
then
4. start fmSyntaxColorizer
5. and press [colorize!]
It's free too. :-)