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:
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
11.3
11.4
Statistic
FMM
Blog
Returns a column as JSON array.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
FM FMSQL JSON | 10.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
SQLref | The reference number returned by FM.SQL.Execute function. | $SQLRef | |
Column | The column index to use from the SQL result. | 0 | |
Flags | The flags for the json creation. Pass 1 to get all values as text. Pass 2 to get all dates, times and timestamps in SQL format. |
1+2 | Optional |
Returns JSON array or error.
Query JSON array of all groups we have:
Set Variable [ $sql ; Value: MBS("FM.SQL.Execute"; ""; "SELECT DISTINCT \"Group\" FROM \"Contacts\" WHERE Length(\"Group\") > 0") ]
Set Variable [ $values ; Value: MBS("FM.SQL.JSONColumn"; $SQL; 0) ]
Set Variable [ $r ; Value: MBS("FM.SQL.Release"; $SQL) ]
Show Custom Dialog [ "Values" ; $values ]
Query two JSON arrays, one for group names and ID list:
Set Variable [ $sql ; Value: MBS("FM.SQL.Execute"; ""; "SELECT DISTINCT \"ID\", \"Group\" FROM \"Contacts\" WHERE Length(\"Group\") > 0") ]
If [ MBS("IsError") ]
Show Custom Dialog [ "Error" ; $sql ]
Else
Set Variable [ $IDs ; Value: MBS("FM.SQL.JSONColumn"; $SQL; 0) ]
Set Variable [ $Groups ; Value: MBS("FM.SQL.JSONColumn"; $SQL; 1) ]
Set Variable [ $r ; Value: MBS("FM.SQL.Release"; $SQL) ]
Show Custom Dialog [ "Values" ; $IDs & ¶ & $Groups ]
End If
Created 2nd October 2020, last changed 26th February 2021
FM.SQL.InsertRecordsToSQL - FM.SQL.JSONRecord
Feedback: Report problem or ask question.