-
Notifications
You must be signed in to change notification settings - Fork 0
Python Native Functions
These functions give Python scripts access to data in FileMaker.
Before using you must import the class into your environment:
import fm
Evaluate a FileMaker expression, returning any results as a Python object. Since FileMaker globals can be set with this it can be used both to set and get values from FileMaker.
Here's a trivial example of a Python function to set a FileMaker global:
def set_global_to_text():
fm.evaluate ('$$myGlobalName = "text"')
This function does not work correctly in bBox 1.06.
This Python function calls back to the FileMaker engine to evaluate your SQL expression, and returns a Python list object with the results.
For example, we can execute this in Python:
r = fm.executesql ("SELECT id,name FROM EXAMPLE")
and get back a result like this:
((95.0, u'last went to sleep'), (90.0, u'calendar for year'))
The optional values parameter is a list of one or values that will be used as SQL parameters. Here we’ll create a new record in the SCRATCH table with the values from the Python variables id and filename:
fm.executesql ('INSERT INTO "SCRATCH" (text_1, text_2) VALUES (?,?)', [id, filename])
Runs a FileMaker script with given script & file name. An optional parameter may be passed in.
To get the script’s result, use:
fm.evaluate ("Get (ScriptResult)")
© 2025 Beezwax Datatools, Inc. All rights reserved.