Select to view content in your preferred language

Change the values of dataDrivenPages

990
2
Jump to solution
09-20-2012 05:54 PM
AlmaSanchez
Emerging Contributor
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! 🙂
Tags (2)
1 Solution

Accepted Solutions
JeffBarrette
Esri Regular Contributor
Arcpy.mapping can not be used to set up or modify DDP settings.  This must be done in the UI.

Jeff

View solution in original post

0 Kudos
2 Replies
JeffBarrette
Esri Regular Contributor
Arcpy.mapping can not be used to set up or modify DDP settings.  This must be done in the UI.

Jeff
0 Kudos
AlmaSanchez
Emerging Contributor
Ok, no wonder it wasn't working... 😞


Thanks Jeff
0 Kudos