AnsweredAssumed Answered

Ignore Null Values using getValue

Question asked by steven_3535 on Mar 10, 2016
Latest reply on Mar 10, 2016 by wwmiller68

I have a script that uses selected feature attributes and pushes them out to a pdf map.  The issue is that when a value is Null, the export PDF doesn't work.  I've been trying various methods to ignore Null values but I can't get it to work right.  Here is the error ArcMap is throwing:

return setattr(self._arc_object, attr_name, cval(val))

RuntimeError: TextElementObject: Error in setting text

Here's the code pushing out the attributes to the layout pdf.  It works right when the value isn't Null.

 

# Set the layer name from the Table of Contents
layer = arcpy.mapping.ListLayers(mxd, "Levee Centerline (Segment Only)")[0]  

 # create a cursor and grab the first row in the feature class for the layer specified above
        rows = arcpy.SearchCursor(layer)
        row = rows.next()
        
        #Change title text
        titleElement = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT","TitleText")[0]
        titleElement.text = row.getValue("FC_SYSTEM.System_Name")

 

Any ideas?

 

-Steven

Outcomes