Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
SQL.GetRecordsAsJSON
Queries records of current result set as JSON array.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
SQL | 10.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "SQL.GetRecordsAsJSON"; Command ) More
Parameters
Parameter | Description | Example |
---|---|---|
Command | The command reference number gained with SQL.NewCommand. | $Command |
Result
Returns JSON or error.
Description
Queries records of current result set as JSON array.Each array entry contains a record converted to JSON.
Dates, Intervals and BLOBs get converted to text. Boolean, Integer, Numeric and Double types are converted to numbers in JSON. Boolean is passed through as boolean. Null or unknown field types are returned as NULL in JSON.
Examples
Show record as JSON:
# Create select and run it
Set Variable [ $Command ; Value: MBS("SQL.NewCommand"; $Connection; "SELECT * FROM Test") ]
# Run it
Set Variable [ $result ; Value: MBS("SQL.Execute"; $Command) ]
If [ $result ≠ "OK" ]
Show Custom Dialog [ "Error: " & $result ]
Else
Show Custom Dialog [ "JSON" ; MBS( "SQL.GetRecordsAsJSON"; $Command ) ]
End If
# Cleanup
Set Variable [ $result2 ; Value: MBS("SQL.FreeCommand"; $Command) ]
See also
Release notes
- Version 10.2
- Added SQL.GetFieldsAsJSON, SQL.GetParamsAsJSON, SQL.GetRecordsAsJSON and SQL.SetParamsWithJSON functions.
Example Databases
Blog Entries
- Moving data from ODBC to FileMaker via script
- Embrace JSON
- News about the MBS FileMaker Plugin 10.2
- MBS FileMaker Plugin, version 10.2pr1
This function is free to use.
Created 11st March 2020, last changed 11st March 2020