| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
FM.ExecuteSQL.LastParameters
Queries parameters from last failed SQL command.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| FM FMSQL | 16.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "FM.ExecuteSQL.LastParameters" )
Parameters
none
Result
Returns JSON or error.
Description
Queries parameters from last failed SQL command.This allows you to debug problems with MBS functions doing multi commands, so e.g. you can see which values the failed record for an insert.
When an error happens, we serialize the parameters used for the SQL operation.
Value is empty if no parameters have been recorded.
See FM.ExecuteSQL.LastSQL for the corresponding SQL statement and FM.ExecuteSQL.LastErrorMessage for the error message.
Examples
Try it:
MBS("FM.InsertRecord"; ""; "NonExistingTable"; "test"; 123; "other"; "abc") & ¶ &
MBS("FM.ExecuteSQL.LastParameters")
Example result:
[MBS] ERROR: FQL0002/(1:12): The table named "NonExistingTable" does not exist.
[123, "abc"]
MBS("FM.ExecuteSQL.LastParameters")
Example result:
[MBS] ERROR: FQL0002/(1:12): The table named "NonExistingTable" does not exist.
[123, "abc"]
Check the last parameters after causing an error:
Let([
sql = "INSERT INTO Test (FirstName, Age) VALUES (?,?)";
r = MBS("FM.ExecuteFileSQL"; ""; sql; 9; 13; "Joe"; 23);
params = MBS("FM.ExecuteSQL.LastParameters")
]; params)
Example result:
["Joe", 23]
sql = "INSERT INTO Test (FirstName, Age) VALUES (?,?)";
r = MBS("FM.ExecuteFileSQL"; ""; sql; 9; 13; "Joe"; 23);
params = MBS("FM.ExecuteSQL.LastParameters")
]; params)
Example result:
["Joe", 23]
Build a JSON after causing an error:
Let([
sql = "INSERT INTO Test (FirstName, Age) VALUES (?,?)";
r = MBS("FM.ExecuteFileSQL"; ""; sql; 9; 13; "Joe"; 23);
errorCode = MBS( "FM.ExecuteSQL.LastError" );
errorMessage = MBS("FM.ExecuteSQL.LastErrorMessage");
lastSQL = MBS("FM.ExecuteSQL.LastSQL");
params = MBS("FM.ExecuteSQL.LastParameters");
json = JSONSetElement ( "{}" ;
["Parameters"; params; JSONArray];
["ErrorCode"; errorCode; JSONNumber];
["SQL"; lastSQL; JSONString];
["ErrorMessage"; errorMessage; JSONString])
]; JSONFormatElements ( json ))
Example result:
{ "ErrorCode" : 8309, "ErrorMessage" : "ERROR: FQL0002/(1:12): The table named \"Test\" does not exist.", "Parameters" : [ "Joe", 23 ], "SQL" : "INSERT INTO Test (FirstName, Age) VALUES (?,?)" }
sql = "INSERT INTO Test (FirstName, Age) VALUES (?,?)";
r = MBS("FM.ExecuteFileSQL"; ""; sql; 9; 13; "Joe"; 23);
errorCode = MBS( "FM.ExecuteSQL.LastError" );
errorMessage = MBS("FM.ExecuteSQL.LastErrorMessage");
lastSQL = MBS("FM.ExecuteSQL.LastSQL");
params = MBS("FM.ExecuteSQL.LastParameters");
json = JSONSetElement ( "{}" ;
["Parameters"; params; JSONArray];
["ErrorCode"; errorCode; JSONNumber];
["SQL"; lastSQL; JSONString];
["ErrorMessage"; errorMessage; JSONString])
]; JSONFormatElements ( json ))
Example result:
{ "ErrorCode" : 8309, "ErrorMessage" : "ERROR: FQL0002/(1:12): The table named \"Test\" does not exist.", "Parameters" : [ "Joe", 23 ], "SQL" : "INSERT INTO Test (FirstName, Age) VALUES (?,?)" }
See also
- FM.ExecuteFileSQL
- FM.ExecuteSQL
- FM.ExecuteSQL.LastError
- FM.ExecuteSQL.LastErrorMessage
- FM.ExecuteSQL.LastSQL
- FM.InsertRecord
Release notes
- Version 16.2
- Added FM.ExecuteSQL.LastParameters function.
Blog Entries
- MBS FileMaker Plugin 16.2 News
- Neues MBS Plugin 16.2 für Claris FileMaker
- MBS Plugin 16.2 for Claris FileMaker
- SQL error checking improved
- MBS FileMaker Plugin, version 16.2pr1
This function is free to use.
Created 18th March 2026, last changed 27th April 2026