I'm wondering if you can lift the name of a layer in the ToC (within a group) and use it in dynamic text.
Is there existing syntax to do this?
<dyn type="ToC" property="activeLayer"/>
Using ArcMap 10 sp3.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
I use a workaround that has functioned fairly well. I use MXDs to prepare multiple printable maps (in a single MXD) frequently. Typically I'm showing the same bookmark/extent and have consistent background data, BUT want to swap out and highlight specific features in differently named maps. To create a fake dynamic title I add a separate Legend from the one I use to show actual symbology, and just show the Layer Name text. Here are my steps:
I created several MXDs where I used this technique not only to display a 'dynamic title', but also dynamic text such as the 'data source' and 'map prepared by' information. For each of the fake dynamic text features, I utilized a dummy shapefile (no fill/ no outline) and grouped that dummy with any relevant shapefiles/symbology intended for an individual printable map. The MXD can get very large and can get clunky, but you're ensured that basemap data ALWAYS looks the same (you don't have to modify labels/symbology in many MXDs that show the same overall viewport, because it's all saved in a single MXD).
You could write a python script that uses the following mapping modules:
import arcpy mxd = arcpy.mapping.MapDocument("Current") for lyr in arcpy.mapping.ListLayers(mxd): if lyr.name == 'yourlayername': for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"): if elm.text == "defaulttext": elm.text = lyr.name # change layout text