AnsweredAssumed Answered

Export Data Driven Pages to MXD with file name by Page Name

Question asked by brunodeus on Jan 10, 2012
Latest reply on Nov 21, 2013 by Megno
I`m trying export multiple files created by DDP to ".mxd" once each page has the file name defined by the "page name" or by a "field name". Some what the ArcGis already does to export to ".pdf" whereas it exports single-page documents using the page name for the output file name.

I saw a script from Ideas webpage: Export Data Driven Pages to MXD which is almost perfect to me, but the file name came from Page number.

I`ve tried modify It considering all the information that I saw on another pages (Help, ArcGIS Ideas, Foruns), but it doesn`t works until now.
I would like that somebody can helps me. I've made a copy from the last version of script:

>>>import arcpy, os
... mxdPath = r"C:\...\Projeto_DataDrive.mxd" # The original path is too large
... mxd = arcpy.mapping.MapDocument(mxdPath)
... mxdDir = os.path.dirname(mxdPath)
... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
... pageName = mxd.dataDrivenPages.pageRow.COD_APRT #This line wasn't here in the original script. The FieldName who is indexing the DDP is COD_APRT
... mxd.dataDrivenPages.currentPageID = pageNum
... mxdName = os.path.join(mxdDir, "DDPMap" + str(pageName) + ".mxd")# I just modified str(pageNum) to str(pageName)
... mxd.saveACopy(mxdName)
... del mxd
...

I will appreciate any help.

Outcomes