Hi, i've been using the DDPwithDynamicTablesAndGraphs_10_v1 as the base for this script. In my test mxd everything works fine, but in that scenario the index layer is not joined to any other FC. When I try to migrate this code to the production MXD I receive the following error:
Runtime error
Traceback (most recent call last):
File "<string>", line 44, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\_base.py", line 25, in __getattr__
x = getattr(self._arc_object, attr)
RuntimeError: Row: Field LVHarvestUnitID does not exist
A quick summary of the code
#Reference DDP object and set appropriate page
ddp = mxd.dataDrivenPages
ddp.currentPageID = ddp.getPageIDFromName(job)
#Build selection set
jobnumb = ddp.pageRow.LVHarvestUnitID
arcpy.AddMessage("Processing: " + jobnumb)
arcpy.Select_analysis(jobLayer, arcpy.env.scratchGDB, "\"LVHarvestUnitID\" = '" + jobnumb+ " '")
numRecords = int(arcpy.GetCount_management("scratch").getOutput(0))
Line 44 refrences this jobnumb = ddp.pageRow.LVHarvestUnitID
and LVHarvestUnitID is a field name within the Index layer. I had tried to provide a fully qualified name like tablename.field name since the index layer is joined to another FC (in order to grab other attributes for some dynamic text in the layout), but this still returns a similar error.
Thanks in advance! FWIW I contacted ESRI support regarding the issue and because the line of code was borrowed from a sample on arcgis.com (from the map automation team) they said its generally not supported.
Runtime error
Traceback (most recent call last):
File "<string>", line 44, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\arcobjects\_base.py", line 25, in __getattr__
x = getattr(self._arc_object, attr)
RuntimeError: Row: Field LVHarvestUnitID does not exist
A quick summary of the code
#Reference DDP object and set appropriate page
ddp = mxd.dataDrivenPages
ddp.currentPageID = ddp.getPageIDFromName(job)
#Build selection set
jobnumb = ddp.pageRow.LVHarvestUnitID
arcpy.AddMessage("Processing: " + jobnumb)
arcpy.Select_analysis(jobLayer, arcpy.env.scratchGDB, "\"LVHarvestUnitID\" = '" + jobnumb+ " '")
numRecords = int(arcpy.GetCount_management("scratch").getOutput(0))
Line 44 refrences this jobnumb = ddp.pageRow.LVHarvestUnitID
and LVHarvestUnitID is a field name within the Index layer. I had tried to provide a fully qualified name like tablename.field name since the index layer is joined to another FC (in order to grab other attributes for some dynamic text in the layout), but this still returns a similar error.
Thanks in advance! FWIW I contacted ESRI support regarding the issue and because the line of code was borrowed from a sample on arcgis.com (from the map automation team) they said its generally not supported.