Skip to content
FMScriptBridge ← Back to home

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 [email protected].

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 never leave it in a Data Viewer watch, where FileMaker would re-run it on every refresh. The clipboard write is verified by reading it back, so a success message is never false.

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