AnsweredAssumed Answered

CalculateField 2 UpdateCursor

Question asked by Pi-Hellz on Jan 16, 2013
Latest reply on Jan 17, 2013 by Pi-Hellz
I'm trying to convert a simple calculate field to an UpdateCursor that's suppose to compare row value from two columns.

But i'm having an error 99999: Error executing function.
An invalid SQL statement was used.

Thanks for any help!

Below is what I have right now:
Calculate Field
codeblock = "def isSame(x, y):\n\n    fieldA = str(x)\n\n    fieldB = str(y)\n\n    if fieldA == fieldB:\n\n        return 1\n\n    else:\n\n        return 0\n"     isSameQuery = 'isSame =' + str(1)   arcpy.CalculateField_management(outIntersectGlobal,"isSame","isSame( !Name!, !Name_1! )","Python_9.3",codeblock)  


UpdateCursor
UpdateField = 'isSame' whereClause = '"Name"' + "==" + '"Name_1"'  cursor = arcpy.UpdateCursor(OutIntersectBoucle,whereClause) row = cursor.next  for row in cursor:             row.setValue(UpdateField, 1)             cursor.updateRow(row)             row = cursor.next

Outcomes