Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.DeleteRecord
Deletes an existing record 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.DeleteRecord"; FileName; TableName; PrimaryKeys ) 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 delete record from. Can be ID of table, so we lookup name by ID. Can be result of GetFieldName() function as we remove field name automatically. |
"Assets" |
PrimaryKeys | The JSON with keys and values which provides an unique ID for each record, so we can identify the field. Can be RecordID for the record ID. Field name can be the result of GetFieldName() function as we remove table name automatically. If field name is a number with field ID, so we lookup name by ID. |
"ID" |
Result
Returns OK or error.
Description
Deletes an existing record 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 fields must be unique.
Please note that JSON.DeleteRecord and JSON.DeleteRecords are nearly identical. Just JSON.DeleteRecord provides the check to make sure only one record matches while JSON.DeleteRecords allows several records to be deleted. So with JSON.DeleteRecords 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.
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.
The SQL functions in FileMaker do not trigger OnWindowsTransaction script trigger.
Examples
Delete a record:
MBS( "JSON.DeleteRecord"; "MyFile"; "MyTable"; JSONSetElement ( "{}" ; "KeyField" ; 123 ; JSONString ) )
See also
- FM.DeleteRecord
- FM.ExecuteSQL
- FM.ExecuteSQL.LastSQL
- JSON.DeleteRecords
- JSON.InsertRecord
- JSON.UpdateRecord
- JSON.UpdateRecords
Release notes
- Version 14.4
- Added JSON.DeleteRecord and JSON.DeleteRecords functions.
Example Databases
Blog Entries
This function checks for a license.
Created 25th August 2024, last changed 25th August 2024