I'm trying to generate individual mxds for each page in my data driven pages (which I have set up already). I have 38 pages in total, so I would need to generate 38 mxds. The pages are named according to the zone (A, B, C etc.) and the number assigned (1,2,3 etc). Each page would be named something like A1, B2, or C13. The zone name is recorded in attribute table under the field name "DIST_NAME".
I'm not very familiar with python, and this my first foray into python in ArcGIS. I've managed to piece together some code. I have two versions; neither of which works.
I was able to generate individual mxds with this version, but I didn't get the proper file names. I gave me 1, 2, 3 etc. when I wanted A1, A2, A3 etc.
for pageNum in range(1, mxd.dataDrivenPages.pageCount +1): mxd.dataDrivenPages.currentPageID = pageNum mxd.saveACopy(r"H:\Test\\" + str(pageNum) + ".mxd") mxd.dataDrivenPages.refresh()
I got the two pageID lines off from the help site. This generated 1 mxd with the incorrect name.
for pageNum in range(1, mxd.dataDrivenPages.pageCount +1): pageID = mxd.dataDrivenPages.getPageIDFromName("DIST_NAME") mxd.dataDrivenPages.currentPageID = pageID mxd.saveACopy(r"H:\Test\\" + str(pageID) + ".mxd") mxd.dataDrivenPages.refresh()
Can anyone please point out what I'm doing wrong in my code?