Skip to content
FMScriptBridge

Function help

The ? button in FileMaker’s calculation dialog brought you here. These are the calculation functions FMScriptBridge adds. Conversions themselves run from the keyboard shortcuts you set in Configure, not from a function.

The five functions

A shipped build registers exactly these. Pick one on the left for the full description.

  • FMSB_LastError : The detail text of the last FMSB error, or empty if the last FMSB call succeeded.
  • FMSB_LastWarnings : The non-fatal warnings from the most recent conversion, one per line, or empty if it was clean.
  • FMSB_JSONToSetElement : A paste-ready JSONSetElement ( … ) calculation built from the JSON you pass in.
  • FMSB_JSONToLoopSteps : A complete, readable FileMaker script that loops your records and composes the JSON you pass in.
  • FMSB_CopyAISpec : "specs copied to clipboard", or a loud error (see FMSB_LastError).

Landed here from a function this page does not list? Your plugin build is newer than this page; update notes on the changelog say what was added. Anything else, email info@fmscriptbridge.com.

FMSB_LastError

Read-only

When a hotkey conversion fails, the short on-screen notice tells you something went wrong; when a calc function fails, the call itself errors. Either way, this function holds the detail. Evaluate it in the Data Viewer or a script right after the failing call.

Reading it never clears it - the next FMSB operation replaces or resets it, so read it (and FMSB_LastWarnings) in any order after a failure. Error text points at where the problem is, such as a line number in the converted text. It never contains your script content, so it is safe to read anywhere.

Returns: The detail text of the last FMSB error, or empty if the last FMSB call succeeded.

FMSB_LastWarnings

Read-only

A conversion can succeed and still want to tell you something: an XML-invalid byte was stripped, or a step could not be shown as readable text and was kept as raw XML instead. Those notes land here.

Read it after a conversion. Reading never clears it; the next conversion (or FMSB_JSONToSetElement call, which can leave its own note here) resets it. The same warnings are also written to the plugin log.

Returns: The non-fatal warnings from the most recent conversion, one per line, or empty if it was clean.

FMSB_JSONToSetElement ( json )

Calculation

Give it JSON text and it returns the JSONSetElement expression that would rebuild that JSON: every leaf value becomes a [ path ; value ; type ] row, with correct FileMaker bracket-array paths and the right JSON type constant for each value.

Broken JSON, a bare value at the top level, or a key that cannot be written as a FileMaker JSON path returns an error, and FMSB_LastError has the detail - the parse position for malformed JSON, or the offending key by name.

Returns: A paste-ready JSONSetElement ( … ) calculation built from the JSON you pass in.

FMSB_JSONToLoopSteps ( json )

Calculation

Give it sample JSON, the shape you want to export, and it returns a ready-to-wire script in FMScriptBridge's readable text: a loop over your records that builds that JSON piece by piece, nested objects and arrays included. Push it into FileMaker with the convert hotkey.

The script arrives with clearly marked SET THIS lines (each one's comment says whether it wants the field itself or its quoted name), and a safety gate that keeps it from running until you flip the If [ False ] line at the top to True. Fill the lines in, flip the gate, and run the script from the parent record you want to export.

Input that cannot become a script fails loud instead of guessing: non-JSON text, a bare value at the top level, keys FileMaker paths cannot express, a mixed-type array, or output past the size bound all return an error, with the detail in FMSB_LastError.

Returns: A complete, readable FileMaker script that loops your records and composes the JSON you pass in.

FMSB_CopyAISpec

Action

Copies the FMScriptBridge text-format guide to the clipboard as markdown, version-stamped, ready to paste into your AI assistant so it writes and edits converted scripts in FMScriptBridge's text format instead of guessing it.

This is an action, not a pure calculation: it overwrites whatever is on the clipboard. Evaluate it once, on demand, and do not leave it in a Data Viewer watch, where FileMaker would re-run it on every refresh. Evaluating it in the Data Viewer is fine: the automatic evaluation there may run it more than once in quick succession, and a repeat within a couple of seconds answers with the same success without writing again, as long as the clipboard still holds the spec. If something else is on the clipboard by then, the repeat refuses rather than overwrite it. The clipboard write is verified by reading it back, so a success message is never false.

The first lines of the copy name the grammar version your plug-in speaks. A plug-in accepts text written to its own version and to every earlier one, so a spec you found elsewhere should be that version or older; a newer form is refused at its line, never pasted wrong.

The guide can be re-issued for the build you run: when the daily update check finds a corrected copy published for exactly your version, it downloads it, checks it against the published checksum and its own version stamp, and this function copies that one from then on. Configure > Updates shows which copy is in use, "built-in" or "refreshed", with its stamp. To go back to the built-in copy, delete ai-spec.md and ai-spec.json from the FMScriptBridge settings folder, ~/Library/Application Support/FMScriptBridge (next to config.json; Reveal Log in Configure opens the same folder); the next daily check fetches the current copy again.

The current spec as a web page, for people and search engines The current spec as raw markdown, for an AI agent The same spec as plain text, for an AI tool that will not open a markdown file

Returns: "specs copied to clipboard", or a loud error (see FMSB_LastError).