Skip to content

Native Python, JavaScript, and DuckDB Functions

Simon Brown edited this page Sep 16, 2025 · 1 revision

Python & JavaScript

For these languages there is an added class that can be used to directly integrate from those languages with FileMaker.

query FileMaker, update tables, or run scripts. For Python, you will need to add the following to your script:

import fm

Except for the fm.executesql function, the parameters are identical for Python & JavaScript. In a future bBox version the JavaScript executesql parameters will be identical.

The functions are:

  • bBox_Bash function & script step
  • fm.evaluate (expression)
    • expression: text containing a valid FileMaker calculation
    • result: a Python value based on result of expression
  • fm.executesql (expression) [JAVASCRIPT]
    • expression: a FileMaker SQL expression
    • result: a string result from the SQL query (or ?)
  • fm.executesql (expression {, values} ) [PYTHON]
    • expression: a FileMaker SQL expression
    • values: one or more SQL parameters to be used in the SQL expression
    • result: a string result from the SQL query (or ?)
  • fm.run (filename, scriptname {, parameter} )
    • filename: FileMaker file name
    • scriptname: FileMaker script name to run
    • parameter: passed to FileMaker script

The fm.evaluate function may seem to be mainly about pulling data out of FileMaker into Python, but you can also push data out by setting FileMaker variables with the evaluate statement. fm.executesql can naturally work in both directions using a SELECT statement to pull data in, or an UPDATE or INSERT to push data out to FileMaker. Rows and columns are returned as a non-mutable Python list (tuple), so there is no need to specify characters to delimit these like you would with FileMaker’s ExecuteSQL function.

DuckDB

DuckDB can also do this using a DuckDB extension that gets injected into the environment.

Clone this wiki locally