Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4    Statistic  

FM.DeleteRecord

Deletes an existing record in a table in one line.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
FM FMSQL 6.0 Yes Yes Yes Yes Yes

MBS( "FM.DeleteRecord"; FileName; TableName; IDField; IDValue { ; IDField2; IDValue2; IDField2; IDValue3 } )

Parameters

Parameter Description Example value
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. "Assets"
IDField The name of the first field which provides an unique ID for each record, so we can identify the field. "ID"
IDValue The value for the first ID field to identify the record.
Data type of parameter must match the data type of the field.
$RecordID
IDField2 Optional
Available in MBS FileMaker Plugin 8.2 or newer.
The name of the second field which provides an unique ID for each record, so we can identify the field.
"PersonID"
IDValue2 Optional
Available in MBS FileMaker Plugin 8.2 or newer.
The value for second ID field to identify the record.
Data type of parameter must match the data type of the field.
$PersonID
IDField2 Optional
Available in MBS FileMaker Plugin 8.2 or newer.
The name of the third field which provides an unique ID for each record, so we can identify the field.
"CompanyID"
IDValue3 Optional
Available in MBS FileMaker Plugin 8.2 or newer.
The value for third ID field to identify the record.
Data type of parameter must match the data type of the field.
$CompanyID

Result

Returns OK or error.

Description

Deletes an existing record in a table in one line.
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 be unique.

Please note that FM.DeleteRecord and FM.DeleteRecords are nearly identical. Just FM.DeleteRecord provides the check to make sure only one record matches while FM.DeleteRecords allows several records to be deleted. So with FM.DeleteRecords you can easily erase a lot of data if you pass wrong ID!

With plugin version 7.2 or later, you can specify fields and table via IDs and the plugin will lookup them for you at runtime.

Version 8.2 allows to specify up to 3 ID parameters.

With plugin version 8.4 or newer, 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.

Examples

Delete a record based on values:

Set Variable [ $r ; Value: MBS( "FM.DeleteRecord"; Hole(DateiName); "Contacts"; "First"; "Christian"; "Last"; "Schmitz"; "Company"; "Test Inc.") ]

See also

Created 11st December 2015, last changed 31st July 2018


FM.DataViewerContent   -   FM.DeleteRecords

Feedback: Report problem or ask question.




Links
MBS Xojo blog