ExecuteSQL in calculations

Expert

Query any table in your FileMaker file from a calculation field using ExecuteSQL, enabling cross-table lookups without portals or relationships.

What you'll learn

  • The syntax of ExecuteSQL in a FileMaker calculation
  • How to use field separators and row separators
  • Common use cases and important limitations

ExecuteSQL runs a SELECT statement against any table in the current FileMaker file and returns the result as text. Used in a calculation field, it lets you aggregate data, perform cross-table lookups, and query records regardless of the current layout context — without creating a portal or relationship.

1/3
1

Basic ExecuteSQL syntax

ExecuteSQL takes the SQL string, a field separator, a row separator, and optional bind parameters. Table and field names must match their FileMaker names exactly (case-sensitive in some versions).

FileMaker Script
ExecuteSQL (
  "SELECT SUM("Amount") FROM "Invoices" WHERE "Status" = 'Paid'" ;
  "" ;   // field separator
  ""     // row separator
)

Sign in to track your progress and pick up where you left off.

Sign in to FM Dojo