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:
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
11.3
11.4
Statistic
FMM
Blog
Inserts a lot of records queried from a database.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
FM FMSQL | 6.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
InsertFileName | The file name of where the insert table is inside. Can be empty to look for the table in all files. | Get(FileName) | |
InsertTableName | 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" | |
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" | |
QueryFileName | The file name for the database to run the query against. Can be empty to look for the table in all files. | Get(FileName) | |
SQL Statement | SQL Statement as a Text string | ||
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.
Copy records within one table in same file:
MBS( "FM.InsertRecordQueryIgnoreDuplicates"; ""; "Contacts"; "First¶Last¶Company"; ""; "SELECT \"First\", \"Last\", \"Company\" FROM Contacts" )
Copy records from a table from one database to other (production to development)
MBS( "FM.InsertRecordQueryIgnoreDuplicates"; "ContactsDev.fmp12"; "Contacts"; "First¶Last¶Company"; "Contacts.fmp12"; "SELECT \"First\", \"Last\", \"Company\" FROM Contacts" )
Copy data to other table:
MBS( "FM.InsertRecordQueryIgnoreDuplicates"; ""; "Test"; "FirstName¶LastName¶CompanyName"; ""; "SELECT \"First\", \"Last\", \"Company\" FROM Contacts" )
Query sum of sales grouped by customers in a sales report table:
MBS( "FM.InsertRecordQueryIgnoreDuplicates"; ""; "SalesReport"; "SumSales¶CustomerID"; ""; "SELECT sum(\"InvoiceTotal\"), \"CustomerID\" FROM Clients, Invoices WHERE Invoices. CustomerID = Clients.CustomerID GROUP by CustomerID" )
Copy two fields from one table to other:
MBS( "FM.InsertRecordQueryIgnoreDuplicates"; ""; "ASC Apple Script"; "Name¶Script"; ""; "select * from \"AppleScript\"")
Created 18th January 2016, last changed 5th June 2021
FM.InsertRecordQuery - FM.InsertRecordTSV
Feedback: Report problem or ask question.