July 21, 201312 yr Im pretty new to FileMaker and have a 2 part question. First, I wanted to know if there is somehow a current list of $ and $$ Variables used in scripts? The reason I am asking is to avoid potentially using the same variable name for two different purposes within scripts. I suspect this comes largely down to "proper development principles" to avoid such a conflict, however that sort of "evaluation" feature wouldn't hurt anybody. This is prompted by the fact that I had the same variable name in two seperate scripts; one to filter a portal and the other to set an FK (I caught it before it went into action, and upon further inspection one was global and the other was local, so it would've been fine - but this is obviously an isolated event and I can't help but feel I'm doing something quite poorly). Second, is there a "go to" guide for a sort of "Industry Standard?" I've noticed a lot of people use the same/similar formats such as (for fields) cValue, gLength, etc to help identify. Any other advice related to this situation, no matter how loosely, is greatly appreciated.
July 21, 201312 yr A local variable is only valid for the script in which it is set. A global variable persists for the entire time a file is opened. I tend to name both kinds with a name which has meaning for its purpose. The same name can be used and set in many different scripts but the purpose is the same. It could be something as simple as Get(CurrentDate) which many scripts might use. Of course, it has to set per script and there could be a good reason NOT to make it $$. Rick.
July 21, 201312 yr Author Yes, I found I've been trying to use $$ only when absolutely necessary with the preference to use $ whenever possible. $$ seems to inherently pose the possibility for innaccuracy and/or headaches making sure you clear them at the "proper times."
July 21, 201312 yr If you have FileMaker Advanced, you can run a DDR report, which gives you all the details on the database structure, scripts, etc. And you can find all the variables by searching the HTML document it creates. One note, there is a way to set a $ variable that persists outside of a script or calculation...but it's use is rarely inside a novice's toolbelt.
July 22, 201312 yr A variable in a Let () statement, set via Conditional Formatting, or a calculation field (an auto-enter), or tooltip will set the variable and it will persist semi-Globally.
July 22, 201312 yr Calculations can also refer to local ($) variables which are fed their value for current-record evaluation via script. I have yet to find a reason to use it but I know it works (I've tested) and I know it can be useful (because Ray Cologon said it).
Create an account or sign in to comment