Find Matching Records
 
Purpose 
Finds records based on the context of a specified field.
See also 
Format 
Find Matching Records[Replace/Constrain/Extend; <table::field>]
Options 
 •
Specify target field specifies the field you want to search by.
 •
Replace searches the entire database and replaces the current found set with records that match the contents of the active field.
 •
Constrain searches the found set and displays matching records based on the contents of the active field (a logical AND search).
 •
Extend broadens your found set to include additional records that match criteria in the specified field (a logical OR search).
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server scheduled script 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 12.0
Description 
Finds records based on the context of a specified field, letting you create scripts that behave similarly to using the shortcut menu in Table View.
If you do not specify a field, FileMaker Pro searches based on the contents of the field that is active when the script runs. If data is selected in the active field, FileMaker Pro searches for the selected data. If data is not selected, FileMaker Pro searches for the entire contents of the active field. If you do not specify a field and there is no active field when the script runs, FileMaker Pro displays an invalid command alert.
Find Matching Records runs in Browse or Preview modes. If the database is in another mode when the script runs, FileMaker Pro switches to Browse mode before running the script.
Find Matching Records can be copied and pasted or imported into other FileMaker Pro files.
Example 1 
Finds all records with the same category as the current record, then switches to Table View.
Find Matching Records [Replace; Products::Category]
View As [View as Table]
Example 2 
Opens a new window, goes to the Invoices layout, finds all records in the found set with the same Customer ID as the current record, sorts the new found set, and goes to the first record.
New Window [Style: Document]
Go to Layout ["Invoices"]
Find Matching Records [Constrain; Invoices::Customer ID]
Sort Records [Restore; No dialog]
Go to Record/Request/Page [First]
Example 3 
Either extends the found set with records matching the current record's Customer ID or creates a new found set with records matching the current record's Customer ID.
Show Custom Dialog ["Do you want to add the current customer to the found set?"]
If [ Get ( LastMessageChoice ) = 1 ]
Find Matching Records [Extend; Invoices::Customer ID]
Else
Find Matching Records [Replace; Invoices::Customer ID]
End If
Related topics 
Show Omitted Only script step
Script steps reference (alphabetical list)
Script steps reference (category list)