ExecuteSQLe
Executes an SQL query statement for the specified table occurrence in a FileMaker Pro file and, if an error occurs, returns ? followed by an error message.
Format
ExecuteSQLe ( sqlQuery ; fieldSeparator ; rowSeparator { ; arguments... } )
Parameters
See ExecuteSQL function.
Data type returned
text
Originated in version
21.1.1
Description
ExecuteSQLe is identical to the ExecuteSQL function, except that, if an error occurs during query parsing or execution, ExecuteSQLe returns an error in this format:
? ERROR: FQLxxxx/(line:offset): message
where:
-
xxxx
is a numeric FileMaker query language error code, which is unrelated to the FileMaker error codes -
line
andoffset
are the line number and offset to the character where the error begins in thesqlQuery
parameter -
message
is a description of the error
Only one error is returned at a time. If more than one error is present, another error is returned after the current error is resolved.
Example 1
Starting with Example 1 for ExecuteSQL, change the calculation to use the ExecuteSQLe function. Then, to see a detailed error message, change the query so it refers to a nonexistent field named Title:
ExecuteSQLe ( "SELECT Title FROM Employees WHERE EmpID = 1"; ""; "" )
This returns:
? ERROR: FQL0007/(1:7): The column named "Title" does not exist in any table in the column reference's scope.
Example 2
Sets a variable to the result of the query in Example 1, then checks whether the result begins with ?. If it does, it displays the rest of the result (the error message) and exits the script.
Set Variable [ $result ; Value: ExecuteSQLe ( "SELECT Title FROM Employees WHERE EmpID = 1"; ""; "" ) ]
If [ Left ( $result ; 1 ) = "?" ]
Show Custom Dialog [ Right ( $result ; Length ( $result ) - 2 ) ]
Exit Script [ Text Result: "error" ]
End If