Querying related records

ArcGIS Viewer for Silverlight supports finding a feature's related records. If the related records belong to a layer, the geometry of each related record is returned and displayed on the map as a point, polyline, or polygon. Additionally, the related records are displayed in the attribute table. If the related records belong to a table, the records are only displayed in the attribute table.

The query related records tool is located on the pop-up toolbar and will query the related records of the feature that is clicked. To use this functionality, on-click pop-ups must be enabled for the layer (this is enabled on feature layers by default). When the pop-up displays for a feature, the tool is enabled (visible) if a relationship for the service containing the feature is detected. If there is no relationship detected, the tool will be unavailable. After executing the query (clicking the tool), the results are returned and displayed in the attribute table and also on the map, if applicable. If there are no related features, a message displays in the pop-up to indicate that no records were found. When the results of the query are initially shown on the map, they are displayed as a temporary layer, and are removed when another query is executed or if the pop-up is closed. If you want to keep the results as a permanent layer on the map, you can check the Keep results on map checkbox.

NoteNote:

The query related records functionality is only enabled for features within feature layers. For more information on the difference between a feature layer and other layer types, refer to the Layer types help topic.

See the following section for detailed steps to query related records.

Querying related records

  1. Click a feature on the map. If the layer containing the feature has relationships, the Query Related Records tool appears in the pop-up toolbar.
    Query related tool on pop-up toolbar
  2. Click the tool to execute the query. The results of the query are returned and a temporary layer is created that displays the features as red points, lines, or polygons. If there are no related records for a feature, a message is displayed in the pop-up to inform the user. Note that closing the pop-up window or re-executing the query will remove the temporary layer.
  3. To add the results of the query to the map permanently (create a layer), check the Keep results on map checkbox. You can toggle this checkbox to specify whether to keep the results of each query on the map. Once a layer has been added to the map, you can work with it just as with any other layer, including removing, renaming, reordering, and configuring its look and feel (i.e. symbology).
    Query related tool with Keep results on map option

Extending the query related records tool

For developers, the tool's full source code has been made public on ArcGIS Online. The implementation follows the Model View ViewModel (MVVM) pattern, shows how to query for related records, interact with the pop-up, and more. To view the source code, download the file from ArcGIS Online and open the sln file. To debug the add-in, follow the instructions provided in the Deployment and Use Instructions text file included with the sample.

1/26/2015