Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Inserts or updates a record in a table in one line.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
FM FMSQL | 6.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
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 |
FieldName... | A field name to set. Can be ID of field, so we lookup name by ID. Can be result of GetFieldName() function as we remove table name automatically. |
"Model" |
FieldValue... | A field value to use for setting the field in the parameter before. Data type of parameter must match the data type of the field. |
"Test" |
Returns OK or error.
Update a record:
MBS( "FM.InsertOrUpdateRecord";
""; "Asset Management"; /* file and table name */
"Asset ID"; "1"; /* ID field and value */
"Information"; "Just a test"; /* first field and value */
"Category"; "BestItems" ) /* second field and value */
Insert or update record with 1 key field and 4 fields:
MBS("FM.InsertOrUpdateRecord"; $fileName; $tableName;
$field1; $value1; // <- primary key field name and value
$field2; $value2; $field3; $value3; $field4; $value4; $field5; $value5)
Set a field with red bold text:
MBS( "FM.InsertOrUpdateRecord";
Get(FileName); "Contacts";
"ID"; Contacts::ID;
"First"; TextStyleAdd ( TextColor ( "Hello" ; RGB ( 255 ; 0 ; 0 ) ); bold ) )
This function is free to use.
Created 5th December 2015, last changed 15th April 2023