Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Python.AddExecuteSQLFunction

Adds an execute SQL function.

Component Version macOS Windows Linux Server iOS SDK
Python 14.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Python.AddExecuteSQLFunction"; PythonRef { ; FunctionName } )   More

Parameters

Parameter Description Example Flags
PythonRef The Python reference number. $python
FunctionName The function name to use.
Default is "FMExecuteSQL".
"FMExecuteSQL" Optional

Result

Returns value or error.

Description

Adds an execute SQL function.
You can register a function to execute SQL in FileMaker if you like to have that. You can pick the name to use, but we default to FMExecuteSQL.
The Python function is then added locally and can be called.

It takes several parameters:
  • SQL expression.
  • Optionally the file name for the database.
  • Optionally parameters as needed for the question marks in the SQL.

Examples

Query SQL from Python:

Set Variable [ $p ; Value: MBS("Python.New") ]
Set Variable [ $r ; Value: MBS("Python.AddExecuteSQLFunction"; $p; "FMExecuteSQL") ]
Set Variable [ $r ; Value: MBS("Python.Evaluate"; $p; "FMExecuteSQL('SELECT PrimaryKey FROM Python')") ]
Show Custom Dialog [ "SQL Result:" ; $r ]
Set Variable [ $r ; Value: MBS("Python.Release"; $p) ]

Use parameters for SQL:

Set Variable [ $p ; Value: MBS("Python.New") ]
Set Variable [ $r ; Value: MBS("Python.AddExecuteSQLFunction"; $p; "FMExecuteSQL") ]
Set Variable [ $r ; Value: MBS("Python.Evaluate"; $p; "FMExecuteSQL('SELECT PrimaryKey FROM Python WHERE Result = ? OR Result = ?', '', 1, 2)") ]
Show Custom Dialog [ "SQL Result:" ; $r ]
Set Variable [ $r ; Value: MBS("Python.Release"; $p) ]

See also

Example Databases

This function is free to use.

Created 31st May 2024, last changed 31st May 2024


Python.AddEvaluateFunction - Python.Clear