You can extract knowledge from GIS data by exploring spatial and tabular relationships. Synchronizing feature selections across related tables can be an effective way to do this. By customizing selection properties, you can automatically select related records. For example, if you select a tax parcel feature, you can review the previous owners and historical sales records for that property.
To enable automatic selection of related records for a layer, do the following:
- Right-click the layer in the Contents pane and choose Properties to open the Layer Properties dialog box.
- On the Layer Properties dialog box, click the Selection tab and check Automatically select related data.
- Create a new selection in the source layer. You can select features using the following methods:
- Interactively draw a selection graphic in the map.
- Interactively select features in the attribute table.
- Use the Select Layer By Attribute or Select Layer By Location tools.
- Optionally update the source layer's selection set. The selected records in the related tables will update automatically.
- To turn off automatic selection of related data, uncheck Automatically select related data on the Layer Properties dialog box, or use the Menu button in the table view.
Tips when working with automatic selection of related data
- A selection only propagates in the from-to, or origin-destination, direction through a relate.
- Understand other content the layer is related to before you enable automatic selection of related data. To check if any layers have preexisting relationships, click the Relates tab on the Layer Properties dialog box.
- While you can enable automatic selection of related records for many layers, selection from a single layer is important since that is the only time the automatic selection behavior is used. Selecting across multiple layers with the automatic selection of related data enabled on those layers will not automatically propagate the selections. You must click the Related Data button on the feature layer's Data tab or the Table tab to manually select the related data you want to see. This will help ensure clear and understandable results.
- It's possible that your data contains a set of relates that loop back around to the starting layer. When this occurs, the selection set will not be passed on any further. In these cases it is recommended to uncheck selection propagation for one or more of the intermediate tables or feature layers.
- When you clear a selection, it also clears the related selection. If, however, you do a partial clear by deselecting features or records from a selection set, the remaining selection is still propagated as if it is a new selection.
Example using automatic selection of related data
Consider a map with two layers, USA_Cities and USA_States, both of which have a populated and standardized field, StateName. The automatic propagation of selection events will yield different results based on the way the relationship between the two layers is defined.
Scenario A
A single relate is defined from USA_Cities (the origin) to USA_States (the destination) based on the StateName field. The Automatically select related data option is enabled on the Layer Properties dialog box for each layer. Begin with a clear selection set and select the cities Houston and Dallas. Two features are selected in USA_Cities (Houston and Dallas), and one feature is automatically selected in USA_States (Texas). This is because cities can have a many-to-one relationship with their home state.
If the selection set is cleared and the selection begins instead from the state of Texas, no features are selected in USA_Cities and one feature is selected in USA_States (Texas). This is because the selection was not made from the origin or source layer where the relate was made. A relate does not traverse in the to-from direction.
Scenario B
In this case, the single relate is defined in the opposite direction from Scenario A, where USA_States is related to USA_Cities based on the StateName field. Automatically select related data is enabled for both layers. With no features selected, select the cities of Houston and Dallas. Two features are selected in USA_Cities (Houston and Dallas), and no features are selected in USA_States. This is because the relate does not traverse in the to-from direction.
If the selection set is cleared and a new selection starts from the state of Texas, one feature is selected in USA_States (Texas), and many features are automatically selected in the USA_Cities layer (Houston, Austin, Dallas, San Antonio, and so forth). This is because a state has a one-to-many relationship to the cities within it.