Select to view content in your preferred language

ddp.pageRow.fieldname  Not working when index layer is joined.

894
2
Jump to solution
11-16-2012 04:24 AM
ZacharyHart
Honored Contributor
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.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JeffBarrette
Esri Regular Contributor
I just tested this.  The above post is close.  You need to include the table name.

print ddp.pageRow.getValue("STATES.STATE_NAME")


Jeff

View solution in original post

2 Replies
MattSayler__Work_
Deactivated User
Does this work or same error?

jobnumb = ddp.pageRow.getValue("LVHarvestUnitID")


Also try using the above with the version of the field name with the table reference (like how the Select By Attribute tool shows joined fields, table.fieldname I think).
JeffBarrette
Esri Regular Contributor
I just tested this.  The above post is close.  You need to include the table name.

print ddp.pageRow.getValue("STATES.STATE_NAME")


Jeff