Layout Variables ($$Variables)

Intermediate

Use FileMaker global ($$) variables on layouts for session-scoped state -- mode indicators, selected record trackers, and layout-to-layout communication.

What you'll learn

  • The difference between $ and $$ variable scopes
  • How layout objects reference $$ variables
  • Common patterns for $$ variables: mode flags, selected IDs, UI state
  • How to initialize and clear $$ variables at layout entry and exit

FileMaker variables fall into three scopes: local ($var, script-only), global ($$var, session-wide), and field-stored (persistent). Layout objects can reference $$ variables in calculations (Hide Object When, conditional formatting, field default values) but not in $-only variables. Understanding which scope serves which purpose prevents scope-related bugs.

1/4
1

Scope review: $, $$, and global fields

Local variables ($var) exist only within the running script. Global variables ($$var) persist for the entire client session until explicitly cleared or the solution is closed. Global fields are stored in the database (persistent across sessions). Layout calculations can only see $$ and global fields -- not $ variables.

FileMaker Script
// Scope comparison:
// $localVar     -- visible only within the current script run; gone when script ends
// $$globalVar   -- visible everywhere in the session (all scripts, all layouts)
//                 persists until explicitly cleared or session ends
// Globals::gField -- stored in FM database; survives closing/reopening the file;
//                   shared across all users (global storage = one value per client)

// Layout calculations (Hide Object When, conditional format, etc.):
// [x] Can reference: $$globalVar, Globals::gField
// [ ] Cannot reference: $localVar (out of scope outside a script)

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

Sign in to FM Dojo