AnsweredAssumed Answered

Strange behavior of getValue (field_name) method for Row object

Question asked by mishfaq on Oct 14, 2012
Latest reply on Oct 18, 2012 by Wayne_Whitley
Greetings all,
I just wanted to check if I am the only one experiencing this problem or might be making a mistake in the usage of Row object 'getValue(field_name)' method. I believe this method was working fine with ArcGIS 10 release but it is throwing error in 10.1. I tried to go through the documentation at 'http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000008r000000' but it seems that code sample at same page never uses this method instead is using 'row.FIELD_NAME'. The row.FIELD_NAME method works fine but it is kind of hardcoding the field name which no one would like. Please comment or suggest if you have a solution to this problem. Here is the code snippet which throws an error.


cur = arcpy.SearchCursor(inputFC)
row = cur.Next()

while row:
        print(row.getValue(field_name)) # if I just replace this line with 'print(row.FIELD_NAME) then it works fine.
        row = cur.Next()

del cur

Thanks in advance for your time and support.

Outcomes