Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
SQL.GetFieldsAsJSON
Queries fields values current record as JSON object.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| SQL | 10.2 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example |
|---|---|---|
| Command | The command reference number gained with SQL.NewCommand. | $Command |
Result
Returns JSON or error.
Description
Queries fields values current record as JSON object.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 records 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
Loop
Set Variable [ $result ; Value: MBS("SQL.FetchNext"; $Command) ]
Exit Loop If [ $result ≠ 1 ]
Show Custom Dialog [ "JSON" ; MBS( "SQL.GetFieldsAsJSON"; $Command ) ]
End Loop
End If
# Cleanup
Set Variable [ $result2 ; Value: MBS("SQL.FreeCommand"; $Command) ]
See also
- SQL.Execute
- SQL.FetchNext
- SQL.FreeCommand
- SQL.GetFieldAsJPEG
- SQL.GetFieldAsPDF
- SQL.GetFieldAsPNG
- SQL.GetFieldAsText
- SQL.GetFieldAsTime
- SQL.GetRecordsAsJSON
- SQL.NewCommand
Example Databases
Blog Entries
Release notes
- Version 10.2
- Added SQL.GetFieldsAsJSON, SQL.GetParamsAsJSON, SQL.GetRecordsAsJSON and SQL.SetParamsWithJSON functions.
Created 11st March 2020, last changed 11st March 2020
SQL.GetFieldValueList - SQL.GetIsolationLevel
Feedback: Report problem or ask question.
Links
MBS Xojo tutorial videos