Brian Dunning's FileMaker Custom Functions

SqlListToArrayList ( ~sql_list, ~column_delimiter )

Converts a List of delimited values to a List of JSON Arrays

  Be the first to rate this function Log in to vote

Benedick Miller   Benedick Miller - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
abc,101
def,42
xzy,99
  Sample output:
["abc",101]
["def",42]
["xyz",99]

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

Converts a List of delimited values to a List of JSON Arrays
Requires FM 18 or greater with the While Function

Designed to convert the output of an ExecuteSQL() query to a list of JSON arrays
will also work for any other list of delimited values

Sample input:

abc,101
def,42
xzy,99

Sample Output:

["abc",101]
["def",42]
["xyz",99]


By design empty values are set as empty strings in the arrays, not to null,

Number values are saved as numbers, other values are saved as strings.

Input must a be a list.
Column delimiter is "," be default, if not specified. Another delimiter may be specified, but not ¶

Recursive: the custom function is not recursive, the while function is recursive
Dependencies: none

 

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: