import arcpy
mxdDocumentPath = r"C:\tmp\MapProjects\DataDrivenPages.mxd"
mxd = arcpy.mapping.MapDocument(mxdDocumentPath)
indexLayer = r"C:\tmp\Test.gdb\PolygonFeatures"
#iterate through data driven pages
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum
#check first data frame from Layuot (if you have more than one use wilcard, eg. ListDataFrames(mxd,"Layers")
df = arcpy.mapping.ListDataFrames(mxd)[0]
#get the scale of current page (the scale taken is not rounded so first define round factor)
#define round factor: -2: round scale to 100, -1: round scale to 10, etc.
roundFactor = -2
pageScale = round(df.scale, roundFactor)
#take some identificator of feature in current page, eg. OBJECTID, FID, etc.
ddpFeatureID = mxd.dataDrivenPages.pageRow.OBJECTID
#open UpdateCursor on one row of indexLayer
#if you use TEXT field as an identificator use '"textField" = ' + "'" + str(ddpFeatureID) + "'" as a WHERE clause
updCur = arcpy.UpdateCursor(indexLayer, '"OBJECTID" = ' + str(ddpFeatureID))
for updCurRow in updCur:
#update Scale field of DOUBLE type (create this field before running script)
updCurRow.setValue("Scale", pageScale)
updCur.updateRow(updCurRow)
del updCur
I crafted some code which may be helpful.
First, create Scale field of double type in your data. Then adjust pathes and rounding in script:import arcpy mxdDocumentPath = r"C:\tmp\MapProjects\DataDrivenPages.mxd" mxd = arcpy.mapping.MapDocument(mxdDocumentPath) indexLayer = r"C:\tmp\Test.gdb\PolygonFeatures" #iterate through data driven pages for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum #check first data frame from Layuot (if you have more than one use wilcard, eg. ListDataFrames(mxd,"Layers") df = arcpy.mapping.ListDataFrames(mxd)[0] #get the scale of current page (the scale taken is not rounded so first define round factor) #define round factor: -2: round scale to 100, -1: round scale to 10, etc. roundFactor = -2 pageScale = round(df.scale, roundFactor) #take some identificator of feature in current page, eg. OBJECTID, FID, etc. ddpFeatureID = mxd.dataDrivenPages.pageRow.OBJECTID #open UpdateCursor on one row of indexLayer #if you use TEXT field as an identificator use '"textField" = ' + "'" + str(ddpFeatureID) + "'" as a WHERE clause updCur = arcpy.UpdateCursor(indexLayer, '"OBJECTID" = ' + str(ddpFeatureID)) for updCurRow in updCur: #update Scale field of DOUBLE type (create this field before running script) updCurRow.setValue("Scale", pageScale) updCur.updateRow(updCurRow) del updCur