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

Python.Evaluate

Evaluates an expression in Python.

Component Version macOS Windows Linux Server iOS SDK
Python 14.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Python.Evaluate"; PythonRef; Expression )   More

Parameters

Parameter Description Example
PythonRef The Python reference number. $python
Expression The Python expression. 1+2

Result

Returns result or error.

Description

Evaluates an expression in Python.
Pass an expression to evaluate with Python.
Returns the result of the expression.

The evaluate runs within the FileMaker process. If you cause an endless loop, FileMaker freezes and needs to be force quit, so please always include an exit condition for your loops. Also if you get Python to crash, FileMaker will crash with it. Use Shell functions to run Python in a separate process.

Examples

Try it:

Set Variable [ $r ; Value: MBS("Python.Evaluate"; $p; "1+2") ]
If [ MBS("IsError") or $r ≠ 3 ]
      Show Custom Dialog [ "Failed to evaluate" ; $r ]
      Exit Script [ Text Result: ]
End If

See also

Example Databases

Blog Entries

This function checks for a license.

Created 23th May 2024, last changed 8th July 2024


Python.DeleteValue - Python.GetTag