Using Page Definition Queries
Page Definition Queries allow you to specify which features of a layer draw based on an SQL query. Though similar to other definition queries, Page Definition Queries differ in that they only work with Data Driven Pages and are dynamic. Features are filtered based on the current page. As you iterate through the pages, the query changes, and a new set of features draw appropriate to the new page. If you have features that overlap page extents and want these features to display in multiple pages, you should consider using clip to customize your map.
For example, suppose you want to create a map book showing crop acreage for each state in the United States. Each state has a separate page in the book displaying the crop acreage by county. To simplify your series of maps, you want to only display crop acreage for the state specific to the map book page. Page Definition Queries allows you to do this quickly and easily.
Here is an example of what a couple of the pages would look like without a Page Definition Query:
As you can see, the map page for Arkansas shows crop acreage information not only for the state of Arkansas but also for the surrounding states. This would be true for all map pages. Using a Page Definition Query can simplify the map such that the crop acreage information is only displayed for the state specific to the page. The example below shows the results when you choose to match features to the page name. You can also choose the inverse, to display features that do not match.
Each map above contains a locator map of the continental United States in the lower left corner of the page layout. In each locator map, you can see the current feature index for the Data Driven Page highlighted in red. The red outline in the locator map is known as an extent indicator. In these examples, the index features are the states of Arkansas and California.
Learn more about using extent indicators to enhance overview or locator maps
There are some important things to keep in mind when using Page Definition Queries.
- Page Definition Queries are only available when Data Driven Pages are enabled. If Data Driven Pages are not enabled, you will not see the Page Definition button on the Definition Query tab of the Layer Properties dialog box.
- If Data Driven Pages are disabled, the Page Definition Query gets ignored, though the query is stored by the layer in case Data Driven Pages is enabled later on.
- A Page Definition Query cannot be applied to the Data Driven Pages index layer. If you need to display index features with a Page Definition Query applied, you should add a copy of the layer to the data frame and apply the Page Definition Query to the copy. This is a common technique for emphasizing the current index feature, and can be used to create a highlight color effect for the index feature.
- Changes made to the Data Driven Pages index layer may cause a layer with a Page Definition Query not to draw. These include changing the index layer or the index layer field name being used for the page name. If changes are made, you may need to re-create the Page Definition Query.
- A Page Definition Queries is a dynamic SQL Where clause based on the values of the designated page name field for Data Driven Pages. Therefore, layers being defined must contain an attribute and appropriate values that can be matched to the designated page name field of the Data Driven Pages index layer. Page Definition Queries react to any change in attribute values in either the index layer field driving the Data Driven Page name or the field specified in the Page Definition Query dialog box. You may need to refresh Data Driven Pages to see any changes for the page currently being viewed.
For best results
- Though the field names do not have to match, the data type for the Page Definition Query field and the Data Driven Page name field should be the same.
- The Page Definition Query field should not contain any null fields.
- Features of the layer you are defining do not overlap pages.
How to create a Page Definition Query
- Right-click the layer in the table of contents and click Properties. Do not attempt this with the Data Driven Pages index layer, as Page Definition Queries are not supported for the current index layer.
- Click the Definition Query tab on the Layer Properties dialog box.
- Click the Page Definition button.
- Click the Enable check box.
- Select the field that matches the Data Driven Pages Page name field from the Page Name Field drop-down list.
- Choose to show either features that Match or Don't Match the page.
- Click OK.