Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  

SQL.GetParamsAsJSON

Queries parameters as JSON object.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
SQL 10.2 Yes Yes Yes Yes Yes
MBS( "SQL.GetParamsAsJSON"; Command )   More

Parameters

Parameter Description Example value
Command The command reference number gained with SQL.NewCommand. $Command

Result

Returns JSON or error.

Description

Queries parameters as JSON object.
Great function for debugging to check if parameters are set correctly.
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

Set parameters and show them:

# Create insert command with setting values
Set Variable [ $Command ; Value: MBS("SQL.NewCommand"; $Connection; "INSERT INTO 'Test' (FirstName, LastName, Birthday, NumberOfOrders, TotalSales) VALUES (:1,:2,:3,:4,:5)") ]
Set Variable [ $result ; Value: MBS("SQL.SetParamAsText"; $Command; 1; SQLite fun::FirstName) ]
Set Variable [ $result ; Value: MBS("SQL.SetParamAsText"; $Command; 2; SQLite fun::LastName) ]
Set Variable [ $result ; Value: MBS("SQL.SetParamAsDate"; $Command; 3; SQLite fun::Birthday) ]
Set Variable [ $result ; Value: MBS("SQL.SetParamAsNumber"; $Command; 4; SQLite fun::NumberOfOrders) ]
Set Variable [ $result ; Value: MBS("SQL.SetParamAsFloat"; $Command; 5; SQLite fun::TotalSales) ]
# Let us show instead of running it
Show Custom Dialog [ "JSON" ; MBS( "SQL.GetParamsAsJSON"; $Command ) ]
# cleanup
Set Variable [ $result2 ; Value: MBS("SQL.FreeCommand"; $Command) ]

See also

Example Databases

Blog Entries

Release notes

Created 11st March 2020, last changed 11st March 2020


SQL.GetParamValueList   -   SQL.GetRecordsAsJSON

Feedback: Report problem or ask question.




Links
MBS FileMaker blog