Sort Records in FileMaker scripts

Beginner

Learn how to sort a found set using Sort Records [Restore] and dynamic sort options, when to unsort for performance, and how Sort interacts with portals.

What you'll learn

  • How to use Sort Records [Restore] and configure sort criteria
  • How to unsort the found set when order does not matter
  • How sort state persists and affects subsequent script steps

Sort Records orders the current found set by one or more fields and is essential for presenting data consistently — but an unnecessary sort on a large found set adds overhead that can be avoided.

1/2
1

Sort records with stored criteria

Sort Records [ Restore ] replays a sort order you defined when setting up the script step. This is the most common pattern for a fixed, predictable sort.

FileMaker Script
# Sort by last name ascending, then first name ascending
# Criteria saved inside the step at script-edit time
Sort Records [ Restore ; No dialog ]

Set Variable [ $error ; Value: Get ( LastError ) ]
If [ $error ≠ 0 ]
  Exit Script [ Result: $error ]
End If

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

Sign in to FM Dojo