Using dynamic text with Data Driven Pages

Having dynamic text is an important part of authoring a successful series of Data Driven Pages. Using dynamic text allows important information on the page layout to change dynamically as you go from one page to another. This information includes text for page titles, page numbers, and labels for neighboring pages (a neighboring page is one that is geographically adjacent to the current page).

If your index layer is a regular grid, such as one created using the Grid Index Features geoprocessing tool, you can use the Calculate_Adjacent_Fields geoprocessing tool to create and populate fields that can be used to label neighboring pages. If you are creating a strip map and use the Strip Map Index Features geoprocessing tool to create the index layer, the layer has precalculated fields for left-right and top-bottom labels.

Here is an example, from Layout view, of a Data Driven Page with a number of dynamic text elements.

Dynamic text elements on a Data Driven Page

Here is how the dynamic text is structured for each example:

Number

Description

Syntax

1

Data Driven Page Name, Data Driven Page Number, and Data Driven Page with Count.

You can access these three Data Driven Page dynamic text elements directly from Insert on the main menu or from the pull-down list on the Data Driven Page toolbar.

1a

Data Driven Page Name corresponds to the current value of the attribute field set as the name field in the Setup Data Driven Pages dialog box.

<dyn type="page" property="name"/>

1b

Data Driven Page Number, if applicable, corresponds to the current value of the attribute field set as the Data Driven Page Number on the Setup Data Driven Pages dialog box. Otherwise, the pages are numbered in increments of one starting with the value set as Starting Page Number.

Page <dyn type="page" property="number"/>

1c

Data Driven Page with Count uses the index value of the current page along with the total number of pages. For example, you may have 10 Data Driven Pages where the starting page number is set to 3. The result for this tag for the first page would be Page 1 of 10.

Page <dyn type="page" property="index"/> of <dyn type="page" property="count"/>

2

A neighbor label with a value.

These tags are constructed such that <dyn type="page" property="Field_Name"> where Field Name is the name of the attribute field holding the name value of the adjacent, or neighboring, page in a particular direction.

If you do not have these fields and your index layer is a regular grid, you can use the Calculate Adjacent Fields geoprocessing tool to create and populate fields that can be used to label neighboring pages.

<dyn type="page" property="PageName_E"/>

3

A neighbor label with static text included in the text element along with the dynamic tag. The label has a value.

The preStr and postStr tag attributes let you specify text to add to the start or end of a parsed dynamic tag. These only appear when the corresponding dynamic tag has a value.

<dyn type="page" property="PageName_S" preStr="The neighbor south is " postStr="."/>

4

A neighbor label with no static text. The label has no value.

<dyn type="page" property="PageName_W"/>

5

A neighbor label with no value. There is a dynamic text attribute to use static text in cases where there is no value.

The emptyStr tag attribute lets you specify specific text to display if the dynamic tag has no value ([empty]).

<dyn type="page" property="PageName_NW" emptyStr="No neighbor"/>

Here is what the page will look like when exported or printed:

An exported Data Driven Page with dynamic text

When the dynamic text tag returns [empty], nothing will be exported or printed. If a text element string parses to nothing, [empty] is shown on the display, but nothing is shown when printing or exporting. This lets you know that a text element is present, but the value the dynamic tag is referring to is currently null.

The entire text element string is evaluated. For example, if you have the text Map Credits: <dyn type="document" property="name"/>", and the document doesn't have credit information, you still see Map Credits: on the layout because the parsed text element string is not blank. It has static text in it. If you export or print the map, Map Credits: will appear on the map. On the other hand, if you have the text <dyn type="document" property="name"/>", you see [empty] on the display, because the parsed text element string is blank. This does not display when exporting or printing the map.

TipTip:

With the dyn type="page", you can create dynamic text with any attribute field of the Data Driven Pages index layer. For example, if you have an attribute on the index layer named POPULATION, you can create a dynamic text tag using the field <dyn type="page" property="POPULATION"/> to dynamically display the POPULATION values for each page in the layout.

How to add dynamic text for neighbor labels

These steps assume that you already have the needed fields and values as part of your Data Driven Pages index layer to create the labels. If you do not have these fields and your index layer is a regular grid, you can use the Calculate Adjacent Fields geoprocessing tool to create and populate fields that can be used to label neighboring pages.

  1. Click Insert > Dynamic Text > Data Driven Page Name from the main menu.
    NoteNote:

    Not all dynamic text elements are available from the menu. This includes dynamic text for Data Driven Page numbers. To include dynamic text for page numbers, you will need to manually edit existing text elements. Adding an available Data Driven Pages dynamic text element from the menu saves you the step of having to type in the type tag. It is already there.

  2. Click the Select Elements tool Select Elements on the Draw toolbar, select the text element you just added, then drag to where you want it on the layout.

    For example, the label for neighboring pages to the north of the current page should be placed at the center top of the layout page. Of course, this assumes that the map rotation is constant and is zero.

  3. Double-click the text element.
  4. Change the value for the property tag to the field name for the page value you want to use.

    For example, if the field name for the page to the north is "PageName_N", you would enter "PageName_N" as the property value. The dynamic text element would look like this: <dyn type="page" property="PageName_N"/>.

  5. Repeat this for additional neighbor labels.

Related Topics


9/15/2011