Brian Dunning's FileMaker Custom Functions

ParseCFParams ( paramStringJSON )

Provides a unified, if slightly idiosyncratic, method for passing multiple JSON params into a CF.

  Be the first to rate this function Log in to vote

Richard Dyce   Richard Dyce - Show more from this author
Dyce & Sons Ltd.
http://dyce.com

Share on Facebook Share on Twitter

  Sample input:
ParseCFParams ( JSONSetElement ( "" ; [ "name" ; "Richard" ; JSONString ]; [ "stuff" ; JSONSetElement ( "" ; [ "name" ; "Richard" ; JSONString ]; [ "Age" ; "51.999" ; JSONString ]; [ "Favourite Colour" ; "Teal" ; JSONString ] ) ; JSONRaw ]; [ "Age" ; "51.999" ; JSONString ]; [ "Favourite Colour" ; "Teal" ; JSONString ] ) )
  Sample output:
4

// plus these variable assignments as side_effects

$stuff = {"Age":"51.999","Favourite Colour":"Teal","name":"Richard"}
$name = Richard
$Favourite_Colour = Teal
$args = 4¶51.999¶Teal¶Richard¶{"Age":"51.999","Favourite Colour":"Teal","name":"Richard"}
$Age = 51.99

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Converts a JSON string parameter into local variables

1. it uses the JSON keys to create local variables ;
2. it also save the list of param values in $args ;
3. it returns the param count ;
4. it preserves JSON object parameters ; and
5. it returns -1 on an empty string or JSON error.

 

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: