Working with related tables and files > Working with the relationships graph > Creating and changing relationships
Creating and changing relationships
1. Choose File menu > Manage > Database, then click the Relationships tab.
2. In the relationships graph, locate the two tables you will be using for this relationships.
They can appear anywhere on the graph, but they must be present on the graph in order to create the relationship. For self-joining relationships, locate the single table; FileMaker Pro will create the second table occurrence for you.
To add a table to the relationships graph, click Add table button. See Adding tables to the relationships graph.
To duplicate a table in the relationships graph, select the table and click Duplicate table button. To rename a duplicated table, click Edit button and type the new name.
Note  You can’t change tables within a relationship; you must create a new relationship.
3. Click a match field in one of the tables and drag to the corresponding match field in the other table.
You can also click Add relationship button and specify the relationship.
Note  For self-joining relationships, drag a match field in the current table outside the table and then back onto the second match field within the current table. Rename the new table occurrence, or click OK to accept the default name.
4. Repeat step 3 for each match field you intend to use in this relationship.
5. To change settings for a relationship, double-click the indicator line between the related tables. (Or, select the relationship and click Edit button.) Then:
Do this
Change or add a match field
Select a new match field and click Change or Add.
Change the relational operator
Select a new relational operator from the list and click Change.
Duplicate or delete a pair of join criteria
Select the paired criteria from the list in the middle part of the dialog box and click Duplicate or Delete.
Add a related record (to the related table) whenever you enter data into a related field in a record of the current table
Select Allow creation of records in this table via this relationship. When this option is selected, entering data in a related field that has no corresponding related record creates a related record based on the match field in the current table.
Delete related records (in the related table) whenever you delete a matching record in the current table
Select Delete related records in this table when a record is deleted in the other table. This option deletes related records even when you're browsing a layout that doesn't display the related records.
Note  When this option is selected in multiple relationships in the same database, deleting a record from one table can also delete related records in other related tables for which the option has been enabled. This is called a cascading delete. You should consider this option carefully before enabling it.
Sort related records
Select Sort records. Then, in the left list in the Sort Records dialog box, double-click the fields to sort. To change the order in which fields are sorted, drag fields in the right list into the order you want. Select other options, then click OK.
To change the sort order, click Specify in the Edit Relationship dialog box.
Selecting this option does not affect the sort order in the related file.
6. Click OK twice.
Select Sort records to display the first found record in a particular sort order (such as the lowest or highest value) when you have one related field directly on a layout of the current table. (For example, display the most recent checkout date for a particular piece of equipment.) Also sort related records to access multiple records that are in a particular sort order and display them in a portal.
When Sort records is selected and data in a related field in a portal changes, the portal records are re-sorted whenever the relationship is reestablished. (For example, records re-sort when you browse out of and then back into the record, or change the value in the match field.)
Because relationships are bidirectional, the tables that appear in the left and right side of the Edit Relationship dialog box have equal capabilities.
When displaying related records in a portal, the Sort Portal Records sort order takes precedence over the sort order specified in the Edit Relationship dialog box.
Related topics 
Working with the relationships graph
About the relationships graph
About the types of relationships
About match fields for relationships
Adding tables to the relationships graph
Defining database tables
Deleting table definitions, field definitions, and data