AnsweredAssumed Answered

Change the values of dataDrivenPages

Question asked by smartgirl on Sep 20, 2012
Latest reply on Sep 21, 2012 by smartgirl
Hi there! I have an mxd with dataDrivenPages already enable but with some values that I want to change, first with a loop I search for a layer named "River" on the mxd, then I want to change what's on the first screen of the DDP window: Index Layer, Layer and Name Field, but so far I haven't been able to do it, I have the next code and I don't get any error messages but nothing really happens.

My Data Frame name is "Carto" and I want to set as Index Layer the layer "River" also that layer has a field named "key" wich is the one that I want to set as Name Field.

mxd = arcpy.mapping.MapDocument(r"D:\MyFile.mxd") df = arcpy.mapping.ListDataFrames(mxd)[0] for lyr in arcpy.mapping.ListLayers(mxd, "Carto", df):     if lyr.name == "River":        mxd.dataDrivenPages.pageRow = "River"        mxd.dataDrivenPages.pageRow.nameField = "key" mxd.dataDrivenPages.refresh() mxd.save()



Any Idea?...


Thanks! :)

Outcomes