Brian Dunning's FileMaker Custom Functions

CG_CVFP ( vars ; vals ; tail )

Create Variables from Parameters

  Average rating: 4.4 (33 votes) Log in to vote

Thomas Mokwa   Thomas Mokwa - Show more from this author
ProFile Developers
http://profiledevelopers.com

Share on Facebook Share on Twitter

  Sample input:
CG_cvfp ( "" ; "" ; "" )

For this example the script name is: "my Script ( var1 ; var2 )"
and the parameter is: "parValue1||2nd Par"
  Sample output:
$var1 = "ParValue1"
$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.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: