Taking full advantage of dynamic text

At 10 we released dynamic text for the layout. This is layout text that updates automatically based on a property from the map, a data frame, or the computer system.  Additionally, if you are using data driven pages, dynamic text can be used for page names, page numbers, or attributes from the index layer.  Dynamic text uses tags in a standard text element string to specify the properties to return. You can use dynamic text to display things like the current date and time, the current user logged in to the computer, or the map author. The most common dynamic text tags can be added using the Insert > Dynamic Text menu.  However, this is only a small number of the types and formats that can be used.

A dynamic text tag always includes a type, for example <dyn type =”document”/> is how you access properties of the map document and <dyn type =”page”/> is used to access properties of data driven pages.  There are seven types available. In addition to document and page are computer, user, date, time, and data frame. For each type there are additional properties or formatting options. You can specify these using the key words property and format.  For example,  <dyn type=”document” property=”credits”/> will return the credits stored in the map document properties, and <dyn type=”date” format=”dddd MMM yyyy”/> will return Thursday Sep 2010.

When working with data driven pages you can return the value of any attribute in your page index layer. Simply specify the dynamic type as page and the property as the attribute. For example, <dyn type =”page” property=”POP_2000”/> will return the population value of the POP_2000 attribute for the current page.

There are other things you can do with dynamic text. For example, you can add the corner coordinates of your data frame to your layout.  Using the data frame type and the properties for upper left, upper right, lower left and lower right you can access the coordinates of each corner.  For example, <dyn type=”dataFrame” name=”DataFrameName” property=”upperLeft.x” units=”dms” decimalPlaces=”2″/> will return the x coordinate in degrees minutes seconds for the upper left corner of your data frame and <dyn type=”dataFrame” name=”DataFrameName” property=”upperLeft.y” units=”dms” decimalPlaces=”2″/> will return the y coordinate. If you pan and zoom, the coordinate will update dynamically with the changes to position.

There are a few special tags for handling null values or empty strings, and for specifying strings that appear either before or after the dynamic text.  These key words are emptyStr, postStr, and preStr. The preStr option allows you to add text before a dynamic text string and the postStr option allows you to add text after a dynamic text string. The emptyStr option lets you specify a string to substitute when the dynamic text returns a null value. For example, when the map author property is not populated, you could use the following: <dyn type=”document” property=”author” emptyStr=”Map author unknown.”/> to return a more descriptive explanation rather than just leaving a blank.  Or in some cases you may want the entire string to disappear. For example, if you are using dynamic text to label adjoining pages in your map book, when you don’t have an adjoining page you may want the entire “See page: “ text to disappear.  <dyn type=”page” property=”PageNumber_N” preStr=”See Page: ” emptyStr = ” “/> will hide the entire “See Page: “ string when the PageNumber_N attribute is empty.


There are many types and formats for dynamic text that are available in addition to those under the Insert > Dynamic Text menu.  These are all accessible through tags that can be added to any layout text element.  For a more complete list, and to start taking full advantage of all the dynamic text options, take a look through the tables and examples in the help doc Working with dynamic text located here.

Content from David Watkins

Next Article

Multi-Scale Contour Styling in ArcGIS Pro

Read this article