
However, anyone who develops FileMaker databases intensively will quickly feel the need to pass not just one but, if necessary, several parameters to a script. Although this is not provided for in FileMaker by default, it is possible using a separate function (Custom Function) easily and conveniently. The various script parameters are simply passed as a text string, which are separated from each other with a specific separator - in my example, I use the vertical bar ( | ) as the separator, which can be achieved on a Mac with the key combination - .
Custom function for separating the individual parameters
In order to create a convenient way of passing several script parameters during development, a Own function (Custom Function) is required, which can separate a text string of the script parameters to be passed into the individual parameters. I call this function in my example SeparateString (). Please note that the Advanced version of FileMaker is required to define your own functions. In FileMaker Pro you will not be able to carry out the points described below.
- Open the administration for your own functions under File > Manage > Own functions
- Click on the button [New...]
- Assign the function name SeparateString
- Specify two function parameters: String and Number
- Now enter the following source text under SeparateString (String; Number) = to:
If(Number = 1; CharacterLeft ( String; (Position ( String; "|"; 1; 1))-1); CharacterCenter ( String; (Position ( String; "|"; 1; Number-1))+1; (Position ( String; "|"; 1; number)) - ((Position ( String; "|"; 1; number-1))+1) ) )
After defining your own function, click on the [OK] button. A new function is now available which you can use to separate any text strings that have been provided with the separator you have specified. This function requires the separator to be specified between the values and once at the end of the text string. To be able to access the various parameters within a script, simply use this function in the corresponding script, e.g. in the following form:
Set variable [$Value_1; Value: SeparateString (Get(ScriptParameter); 1)] Set variable [$Value_2; Value: SeparateString (Get(ScriptParameter); 2)]
For example, if the previously passed script parameter was:
Script parameter: "Address|Change|"
...then the passed in this example contains Variable $Value_1 the value Addressand $Value_2 contains the value Change. You can now use your new custom function wherever you want to pass several parameters by simple means and read them out again afterwards.

Markus Schall has been developing individual databases, interfaces and business applications based on Claris FileMaker since 1994. He is a Claris partner, FMM Award winner 2011 and developer of the ERP software gFM-Business. He is also a book author and founder of the M. Schall Publishers.
