NightWing Enterprises Demo for FileMaker Pro 8 thru 11**
|
To mark the release of the FileMaker Pro 9 Bible!
|
Multiple Script Parameter Values
Straightforward technique using standard Name/Value pairs.
For FileMaker 8 thru 11**
As a courtesy to fellow developers and potential clients, the
following demonstration file is provided for free download.
|
Yes, we know that various methods of passing multiple parameters have been described by others, ever since the release of FileMaker 7 in 2004. But it's time to re-think, because there are several things about the method shown here that are different! Most importantly, the method of passing parameters in the method demonstrated here:
- Supports standard familiar name/value pairs as its input.
- Uses only a single Custom Function to do *all* the heavy lifting.
- Requires only a single step at the start of each script.
- Declares each named parameter value as a correspondingly named local variable within the script, so that it can be referenced by name through the course of the script.
So, for example, if you call a script and pass a parameter such as:
"invoice: IV00147; product: PR0003289; price: $37.50; quantity: 17"
...the first line of your script immediately converts the incoming parameter to four local ($) variables, as follows:
$invoice = IV00147
$product = PR0003289
$price = $37.50
$quantity = 17
|
The format of the name/value pairs you can use not only supports stock standard string format shown above, but also allows you to place each name/value pair on a separate line, for added clarity - or to put each name on one line with the corresponding value on the line below it (the the demo's info screen for additional details). The system also supports passing multi-value parameters (ie CR-delimited lists within a single named value).
Individual values are not normally required to be enclosed in quotes (ie quotes are optional). But quotes can be added to enable you to pass parameters that include semi-colon characters, or to preserve leading or trailing spaces as part of a value.
The demo file contains four records which provide examples of several of the different formats of name/value paired input strings that the system supports. A very simple example script passes the incoming parameter to a series of local variables - then pauses, so that you can observe the resulting variable set in the current tab of the Data Viewer (*requires FileMaker Pro 9 Advanced).
** |
The demo technique is fully operable in FileMaker Pro v8.x and later, but FileMaker Pro Advanced is required in order to observe the declared variable values in the Data Viewer (as pictured below), as well as to install the supplied Custom Function in your own solution files.
|
As a bonus, the demo file includes a second custom function, "GetNamedValue( )", that allows you to extract a designated value from a string of name/value pairs. This function returns the specified value as a result, rather than passing it to a variable, so it is suitable for use outside of scripts (eg in calculations or anywhere else you are working with data packaged as Name/Value pairs).
The system shown in this demo is an extension of a technique that is described in the FileMaker Pro 9 Bible (Chapter 13 - Scripting in Depth, pp470-472).
This demo file is unlocked and password-free, compliments of NightWing Enterprises.
|
|
|
NB: If you may require assistance implementing procedures such as those shown in our
example files, please consider establishing an account with us for developer support.
|
|