Below is a portion of a script that works with a ddp enabled map document using an index grid where the name is a string (examples A23, B34, etc) and the sort field (ie the page names) are simple integer values. The first portion makes a list of page numbers based on a query and the second part exports those pages as PDFs.
I'm trying to modify it for a different index grid where the sort field is the same field as the string name field so the range function doesn't work. I can get a list of all the page names that I want to export but I can't figure out how to acutally get them to export. I figure its something along the lines of "for items in names_list:...." but I can't find a list of ddp functions anywhere so I'm really stuck. Anyone know how to make this work or alternatively does anyone know where a list of ddp python functions and their use exists?
for row in arcpy.SearchCursor(grid): expression = str(row.getValue(field_name)) if expression.startswith(letter_block): x = row.getValue(field_num) range_list.append(x) for page_num in range(range_list, range_list[len(range_list)-1]+1): mxd.dataDrivenPages.currentPageID = page_num page_name = mxd.dataDrivenPages.pageRow.getValue(field_name) arcpy.mapping.ExportToPDF(mxd, str(page_name) + ".pdf")