CG_CVFP ( vars ; vals ; tail )
Create Variables from Parameters
Average rating: 4.4 (33 votes) Log in to vote
Thomas Mokwa - Show more from this author
For this example the script name is: "my Script ( var1 ; var2 )"
and the parameter is: "parValue1||2nd Par"
$var2 = "2nd Par"
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This custom function generates local variables from a Script Name and passed parameters.
parameters as local variables can make a script much easier to read (and write). Other methods of doing this might require named parameters to be parsed out one by one or they use global variables that should then be cleared at the end of a script. This method requires a single script step where the local variable is defined in the script name. Passed parameters are simply return delimited.
Format your script name as: "MyScript Name (var1 ; var2 ; var3...)"
There is no limit to the number of parameters passed.
When passing mulitple parameters you must separate them with a return (¶).
The custom function is called with no parameters.
Set Variable [$result; Value:CG_cvfp(""; ""; "")]
The function parses the script name and matches with the script parameters to create local variables which can be referenced throughout a script.
Passed parameter values cannot contain semicolons or parenthesis. You can either swap them out prior to passing or modify the function to use different delimiters such as brackets and pipes.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.