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:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Insert or updates a lot of records queried from a database.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
FM FMSQL | 8.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
InsertFileName | The file name of where the target table. Can be empty to look for the table in all files. |
Get(FileName) | |
InsertTableName | The name of the table to insert record into (target). Can be ID of table, so we lookup name by ID. Can be result of GetFieldName() function as we remove field name automatically. |
"Assets" | |
FieldNames | A list of field names for the insert. Empty entries in the list are ignored. Can be ID of field, so we lookup name by ID. Can be result of GetFieldName() function as we remove table name automatically. |
"Model" | |
KeyFieldMapping | The list of field names with index to map keys. Please specify a list of key name=key index. The key name is the name of the field in the insert table and the index gives zero-based position in result set from SELECT query in 6th parameter. Field order in source and destination does not need to be the same. |
ID=0 | |
QueryFileName | The file name for the database to run the query against (source). Can be empty to look for the table in all files. |
Get(FileName) | |
SQL Statement | SQL Statement as a Text string to query records from the source table. | ||
Params | Pass here parameters. One parameter to this function for each parameter you want to pass to the SQL statement. | 123 | Optional |
Returns OK or error.
Copies records from Contacts to ContactsCopy:
Set Variable [ $r ; Value: MBS( "FM.InsertOrUpdateRecordQuery"; ""; "ContactsCopy"; "ContactsCopyID¶First¶Last¶Mobile"; "ContactsCopyID=0"; ""; "SELECT \"ContactsID\", \"First\", \"Last\", \"Mobile\" FROM \"Contacts\"" ) ]
Copy values from Assets sample database:
// Source is English version of Assets sample database in FileMaker Pro
// Destination is German version named Anlagen with
MBS( "FM.InsertOrUpdateRecordQuery";
// destination file name
"Anlagen";
// destination table name
"Anlagen";
// destination field names
"Name¶Beschreibung¶Seriennummer¶Bild¶Preis¶Anbieter¶Kaufdatum¶Typ¶Primärschlüssel¶ErstelltVon¶GeändertVon";
// what is primary key in destination table
"Primärschlüssel=0";
// source file
"Assets";
// SELECT statement to query values
"SELECT \"Name\", \"Description\", \"Serial Number\", \"Image\", \"Price\", \"Vendor\", \"Purchase Date\", \"Type\", \"PrimaryKey\", \"CreatedBy\", \"ModifiedBy\" FROM \"Assets\" " )
Created 27th July 2018, last changed 5th March 2021
FM.InsertOrUpdateRecord5 - FM.InsertRecord
Feedback: Report problem or ask question.