Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.UpdateRecords
Updates existing records in a table in one line using JSON.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 14.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "JSON.UpdateRecords"; FileName; TableName; IDField; IDValue; JSON ) More
Parameters
Parameter | Description | Example |
---|---|---|
FileName | The file name of where the table is inside. Can be empty to look for the table in all files. | Get(FileName) |
TableName | The name of the table to insert record into. Can be ID of table, so we lookup name by ID. Can be result of GetFieldName() function as we remove field name automatically. |
"Assets" |
IDField | The name of the field which provides an unique ID for each record, so we can identify the field. Can be ID of field, so we lookup name by ID. Can be result of GetFieldName() function as we remove table name automatically. |
"ID" |
IDValue | The value for the ID field to identify the record. Data type of parameter must match the data type of the field. |
$RecordID |
JSON | The JSON object with the record. |
Result
Returns OK or error.
Description
Updates existing records in a table in one line using JSON.You pass to this function table name (and optional filename).
To identify the record you pass the name of the ID field and the value for the record. The ID field must not be unique, so several records can be updated at once.
Then you pass one pair of field name and value for each field you like to set in the new record.
Please note that JSON.UpdateRecord and JSON.UpdateRecords are nearly identical. Just JSON.UpdateRecord provides the check to make sure only one record matches while JSON.UpdateRecords allows several records to be updated. So with JSON.UpdateRecords you can easily erase a lot of data if you pass wrong ID!
You can specify fields and table via IDs and the plugin will lookup them for you at runtime. Table IDs and table names must be unique across all open files for this to work correctly.
You can use GetFieldName() function to query field names and the plugin removes the table prefix with :: in the field name before passing it to SQL engine.
You can use FM.ExecuteSQL.LastSQL function to see later what SQL was created and run.
See also
- FM.ExecuteSQL
- FM.ExecuteSQL.LastSQL
- FM.UpdateRecords
- FM.UpdateRecords2
- FM.UpdateRecords3
- JSON.DeleteRecord
- JSON.DeleteRecords
- JSON.UpdateRecord
Release notes
- Version 14.4
- Added JSON.UpdateRecord and JSON.UpdateRecords functions.
Example Databases
Blog Entries
- New in MBS FileMaker Plugin 14.4
- Neues MBS Plugin 14.4 für Claris FileMaker
- MBS Plugin 14.4 for Claris FileMaker
- Insert or update with JSON
- MBS FileMaker Plugin, version 14.4pr4
- MBS FileMaker Plugin, version 14.4pr3
This function checks for a license.
Created 20th August 2024, last changed 21st August 2024