Reference > Script steps reference > Navigation script steps > Go to Related Record
 

Go to Related Record

Goes to the current related record(s) in a related table.

See also 

Options 

Get related record from specifies the source relationship from a list of tables in the current database. If the table is not in the list or if you need to add or change a relationship, Manage Database displays the Manage Database dialog box, where you can create or edit relationships.

Show record using layout specifies the layout in the current file that will be used to display the related record(s).

Use external table’s layouts opens the file containing the external table you specify and lets you choose a layout from that file in which to display the related record(s). This option is only available if the source relationship you selected references a table in another file.

Show in new window shows the related records in a new window and lets you specify the settings for the new window. See New Window script step.

Tip  To bring the new window with the related record(s) to the front automatically, add the Select Window script step.

Show only related records creates a new found set in the related table with the options either to match the current record or to match the entire found set. The first record in the found set becomes the current record. (If you don’t select this option, Go to Related Record makes the first record in the table’s unsorted order the current record.)

Match current record only creates a new found set in the related table containing a set of records that match the current record. For example, if there are three records in the related invoice table that match the customer record in the customer table you are currently viewing, and you want to see all three invoices, use Match current record only to display the three invoices.

Match all records in the current found set creates a new found set in the related table that matches all records in the current found set. For example, if you have a found set of ten customers and there are forty invoices in the invoice table that match any of these ten customers, use Match all records in the current found set to display the forty matching invoices. If you don’t define a sort order, the found set will be unsorted.

Animation (FileMaker Go only) specifies the animation to use when displaying the related record in FileMaker Go.

Compatibility 

 

Product 

Supported 

FileMaker Pro 

Partial 

FileMaker Go 

Yes 

FileMaker WebDirect 

Partial 

FileMaker Server 

Partial 

FileMaker Cloud products 

Partial 

FileMaker Data API 

Partial 

Custom Web Publishing 

Partial 

Originated in version 

6.0 or earlier

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 records in this table via this relationship enabled in the Edit Relationship dialog box and Go to Related Record is performed from an empty portal row, the script might produce unexpected results.

Notes 

When this script step opens a new window, the new window doesn’t activate the OnFirstWindowOpen script trigger or the OnWindowOpen script trigger, because the triggered script may not go to the desired layout or view. If you want a script performed after Go to Related Records opens a new window, add Perform Script as the next script step.

The sort order is not maintained if the related records are in an external file.

If this script step is performed in the context of a filtered portal’s row and the Show only related records option is set, only the filtered records are in the new found set. However, if the focus is not in the filtered portal's row, the new found set can include all the related records, not just the filtered records.

You can use animations only for the selected window.

You can’t use animations for navigating between records by using the slider or the status toolbar buttons.

Example 1 

Goes to a related record in the Invoices table and sorts the found set of related records.

Go to Related Record [Show only related records; From table: "Invoices"; Using layout: "Invoices" (Invoices)]
Sort Records [Restore; With dialog: Off]
Go to Record/Request/Page [First]

Example 2 

Goes to a related record in the Invoices table and sorts the found set of related records in a new window.

Go to Related Record [Show only related records; From table: "Invoices"; Using layout: "Invoices" (Invoices); New Window]
Sort Records [Restore; With dialog: Off]
Go to Record/Request/Page [First]

Example 3 

Displays a related record in the Invoices table by sliding the record in from left.

Go to Related Record [Show only related records; From table: "Invoices"; Using layout: "Invoices" (Invoices); Animation: Slide in from Left]

Related topics 

Script steps reference (alphabetical list)

Script steps reference (category list)