Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Matrix.JSONRecords
Returns rows as JSON array.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Matrix | 9.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Matrix.JSONRecords"; MatrixRef; FieldNames { ; Flags; firstRow; lastRow } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
MatrixRef | The matrix reference number. | $matrix | |
FieldNames | A list of field names for the JSON. If empty, we use column names, if you have some. (since 14.3) |
"Model¶Names" | |
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. Pass 4 to get arrays instead of objects for the individual rows. Pass 8 to get containers as objects with name, size and data entries. (new in v12.1) Pass 16 to add field names as first row to the array if flag 4 is set. (new in v14.2) |
1+2 | Optional |
firstRow | Available in MBS FileMaker Plugin 14.2 or newer. The index of first row. Default is 0. |
0 | Optional |
lastRow | Available in MBS FileMaker Plugin 14.2 or newer. The index of last row. Default is FM.SQL.RowCount-1. |
5 | Optional |
Result
Returns JSON text or error.
Description
Returns rows as JSON array.You provide list of field names, which should be in same order as fields in matrix.
Optionally we can return SQL dates, times and timestamps as SQL format.
Containers are returned as Base64 encoded data.
Examples
Query matrix as JSON:
# Matrix as JSON object
Set Variable [ $JSON ; Value: MBS( "Matrix.JSONRecords"; $result; "a¶b¶c" ) ]
Show Custom Dialog [ "Matrix as JSON" ; $JSON ]
See also
Release notes
- Version 14.3
- Changed Matrix.JSONRecord and Matrix.JSONRecords to take field names from column names, if you have some and you don't pass field names.
- Version 14.2
- Added firstRow and lastRow parameter to Matrix.JSONRecords function.
- Added flag 16 for Matrix.JSONRecords to include field names as first row if outputting arrays.
- Version 12.2
- Added AsArray flag 4 for Matrix.JSONRecord and Matrix.JSONRecords functions.
- Version 12.1
- Added flag value 8 for FM.SQL.JSONColumn, Matrix.JSONRecord, Matrix.JSONRecords, FM.SQL.JSONRecord and FM.SQL.JSONRecords to return containers as JSON objects with data, size and name.
Blog Entries
- MBS FileMaker Plugin, version 14.3pr2
- MBS FileMaker Plugin, version 14.2pr5
- MBS FileMaker Plugin, version 14.2pr1
- CSV in FileMaker with MBS FileMaker Plugin
- MBS FileMaker Plugin, version 12.2pr6
FileMaker Magazin
This function checks for a license.
Created 8th April 2019, last changed 7th June 2024