AnsweredAssumed Answered

Loop through Columns and Rows

Question asked by rgthurau on Apr 19, 2012
Latest reply on Apr 19, 2012 by rgthurau
I am trying to use an update cursor to loop through all fields and all rows and replace 0 with 9999. I've looked up a column command that appears to work for some people, but is not going well for me.
Here's the code:

import arcpy, os from import * from arcpy import env arcpy.CheckOutExtension("Spatial") arcpy.env.overwriteOutput = True  areaTab1 = r"X:\DATA\ROW_SP_areaTab"  rows = arcpy.UpdateCursor(areaTab1) for row in rows:     for col in rows:         if row.getValue(row) == 0:             row.setValue(9999)             row.updateRow(row)

Traceback (most recent call last):
  File "C:\_Rich\Project_Temp\", line 13, in <module>
    if row.getValue(row) == 0:
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\", line 945, in getValue
    return convertArcObjectToPythonObject(self._arc_object.GetValue(*gp_fixargs(args)))
RuntimeError: ERROR 999999: Error executing function.

This would be awesome and incredibly useful to be able to run instead of having to search each individual field.

Any help would be greatly appreciated!!