JSONSqlQueryResult ( fieldlist ; keylist ; keytypes ; clauses )
Execute SQL-statement and format directly into JSON, without dependencies (for fmp 18+)
Average rating: 4.0 (1 vote) Log in to vote
Menno van Beek - Show more from this author
Van Beek Zakelijke Software https://www.vbzs.nl |
List (
GetFieldName ( SalesLines::Number ) ;
GetFieldName ( SalesLines::Description ) ;
GetFieldName ( SalesLines::Price ) ;
GetFieldName ( SalesLines::Amount ) ) ;
"" ; /* keylist may be left empty, see description in function */
"" ; /* keytypeslist may be left empty */
"FROM \"SalesLines\" WHERE \"SalesLines\".\"SalesID\"=123456" )
{
"Amount" : 10,
"Description" : "item",
"Number" : 1,
"Price" : 10
},
{
"Amount" : 27,
"Description" : "items",
"Number" : 3,
"Price" : 9
}
]
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This function is intended for straightforward SQL-statements and to have the result poured directly into JSON-format. The function requires fmp 18+ and does not depend on any other custom-function.
Supply at least a list of "Fully Quallified Field Names" and a FROM and WHERE clause. The function will then create the keynames from the fieldlist, but you can also set your own keylist.
The same for the keytypes. Provide a list with only JSONString and JSONNumber values or leave it empty to have the function choose by checking the fieldtypes.
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.