NVPsLoop
Turns a list of name-value pairs into FM $variables
Be the first to rate this function Log in to vote
Richard DeShong - Show more from this author
Logic Tools http://logictools.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This is Part 2 of parsing name-value pairs into FM $variables.
I usually use this to parse the parameter sent to a script.
First, run NVPsInit( InNVPs ) to create the list of name-value pairs.
Second, run this function inside a Loop() to create local $variables for each NVP.
Example Script call: MyScript [ "This=That|Those=Them|When=Now" ]
I am passing Name-Value pairs in a vertical-bar delimited list.
Note that parameters can have returns (pilcro), but not vertical-bars.
Then within MyScript, I call this function, which converts the text string in a Name-Value list,
and then NVPsLoop, inside a Loop, which create FM $vars for each Name pair:
$This = "That"
$Those = "Them"
$When = "Now"
Here how that looks in a script to parse the script parameters:
Set Variable [$init_vars; Value:NVPsInit( Get( ScriptParameter ) )]
Loop
Exit Loop If [NVPsLoop // creates $vars from NVPs string]
End Loop
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.