Script Steps Reference

Table Of Contents
FILEMAKER SCRIPT STEPS REFERENCE 32
Description
Suppose you have an Invoices table that's related to a Customers table and you're currently looking
at a particular invoice. In the Invoices table, you have a button that's set to Go to Related Record
[Customers]. Clicking this button determines which customer record your current invoice is related
to and immediately goes to that record in the Customers table. If the record in question is not
currently in the Customers table’s found set, the script can perform a find to make the record
current.
Tip If the related records cannot be found, this script step returns an error code which can be
captured with the Get(LastError) function.
This script step also works with portal rows. If this script step is used from an active portal row, and
the portal’s table is the related table, then the related record in that table is made current. If the
portal’s table is not the related table, the first related record in the found set is made current.
When used with a table in an external file, this script step will open the file containing the external
table and, if selected, go to the external layout you specify.
There are situations in which a script containing the Go to Related Record script step could modify
an unintended set of records. For example:
If the related records cannot be found, this script step remains on the current layout.
If you select a table occurrence to which there’s no relationship, or a layout that doesn’t
refer to the correct table occurrence, FileMaker Pro displays an error message. After the
error message displays, script execution continues with the next script step.
If there are no related records or no record in the active portal row, the script might produce
unexpected results. Use the IsEmpty function to determine if there are no related records
before using Go to Related Record.
If you have Allow creation of related records enabled and Go to Related Record is
executed from an empty portal row, the script might produce unintended results.
Notes
The sort order is not maintained if the related records are in an external file.
If you are filtering records in a portal, this script step exposes all of the records, not just
the filtered records.
Examples
The following goes to a related record in the table "MyRelatedTable".
Go to Related Record [From table: "MyRelatedTable";
Using layout: “MyLayout”]
The following goes to a related record in the table "MyRelatedTable" and shows a found set of
related records only.
Go to Related Record [Show only related records;
From table: "MyRelatedTable"; Using layout: “MyLayout”]
Related topics
Script steps reference (alphabetical list)
Contents