Go to Portal Row and looping through portal rows in FileMaker

Intermediate

Portals display related records as rows, and Go to Portal Row lets you navigate and loop through each row in a script. Learn the portal loop pattern and how to avoid the common off-by-one mistake.

What you'll learn

  • How to navigate to a portal row with Go to Portal Row
  • The standard counter-based loop pattern for iterating portal rows
  • How to avoid infinite loops and the off-by-one error

Go to Portal Row activates a specific row in a portal, giving your script access to that related record's fields — combined with a loop counter, this is the standard way to process every row in a portal.

1/2
1

Navigate to a specific portal row

Go to Portal Row takes the portal object name and a row number. Row 1 is the first row. After navigating, you can read and write fields in that related record.

FileMaker Script
# Go to the first row of the "LineItems" portal
Go to Portal Row [ Portal: "LineItems" ; Row: 1 ]
Set Variable [ $error ; Value: Get ( LastError ) ]

If [ $error ≠ 0 ]
  # No rows in this portal
  Exit Script [ Result: True ]
End If

# Access the related record's fields
Set Variable [ $price ; Value: LineItems::unitPrice ]

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

Sign in to FM Dojo