Complex multi-request finds with Find mode scripting

Beginner

Build AND, OR, and NOT find logic using multiple find requests, omit criteria, and dynamic field criteria set from script variables.

What you'll learn

  • How multiple find requests produce OR logic
  • How to add an Omit request to exclude specific records
  • How to build find criteria dynamically from script variables
  • How to perform a find on a related field via a portal
  • How to restore the found set after a failed find

FileMaker's find model uses multiple find requests to express OR logic -- each request is an independent set of AND criteria. Omit requests invert a criterion into NOT logic. By scripting Enter Find Mode, adding requests with New Record/Request, setting field values, and calling Perform Find, you can build precisely targeted found sets that no single dialog-based search could produce.

1/4
1

Multiple requests for OR logic

Each find request is like a row in Find mode -- FileMaker unions the results. Add a second request with New Record/Request while still in Find mode.

FileMaker Script
# Find all contacts in California OR Texas
Enter Find Mode [ Pause: Off ]
Set Field [ Contacts::State ; "CA" ]

New Record/Request
Set Field [ Contacts::State ; "TX" ]

Perform Find [ ]

If [ Get ( LastError ) = 401 ]
  Show Custom Dialog [ "No contacts found in California or Texas." ]
  Exit Script [ Text Result: "none" ]
End If

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

Sign in to FM Dojo