import arcpy mxd = arcpy.mapping.MapDocument("Current") mapLyr = arcpy.mapping.ListLayers(mxd, "Detail_2013")[0] concatElem = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "concat")[0] rows = arcpy.SearchCursor(mapLyr.dataSource) row = rows.next() typeElem.text = row.getValue("CONCAT") mxd.save() del mxd, row, rows,
Solved! Go to Solution.
rows = arcpy.SearchCursor(mapLyr.dataSource, "PageID = \'Intersec\'")
rows = arcpy.SearchCursor(mapLyr, "PageID = \'Intersec\'")
import arcpy pageNum = arcpy.GetParameterAsText(0) ddp = mxd.dataDrivenPages arcpy.AddMessage(pageNum) pageID = ddp.getPageIDFromName(str(pageNum)) ddp.currentPageID = pageID rows = arcpy.SearchCursor(mapLyr, "{0} = {1}".format(ddp.pageNameField.name, pageNum))
That has me thinking of two questions. Does the layer being searched have to be the index layer? I imagine that it doesn't. Also, is pageName only a number? I haven't seen anywhere that getPageIDFromName actually returns the string of the field attribute but returns a number based on the sort order of the DDP.
Originally I was expecting the definition queries of the point layer would control which points were being labelled. I didn't know what the python script would disregard that control.