I am trying to fill the fields of one gdb table based on some statistics over the attributes of another shape file. As it was not possible in ARCgis directly, I am trying to use python coe for this case.
I have table A where:
Work_done Length 1 50 100
I would like to say that fill the legth field with sum of the Shape_Length in table B where "work_Done" field is equal another feild in table B.
the following code is what I am thinking and I want to use it in the field_calculator but I got failed. I am not really pro in python therfore I would be really happy if sombody could guide me.
import arcpy from arcpy import env # Set the current workspace env.workspace = "C:/Python27/ArcGIS10.1" table = "Corriodr_stat.dbf" ft = "Length" fc = "Corridor_test.shp" f1, f2 = "Corridor_S", "SHAPE_Leng" for row1 in sorted(arcpy.da.SearchCursor(fc, [f1, f2])): for row2 in sorted(arcpy.da.UpdateCursor(fc, [ft])): if fc.f1 <= 1: table.row2 = getvalueField(sum row1.f2) elif (fc.f1 > 1 and fc.f1 <= 60) table.row2 = getvalueField(sum row1.f2) elif (fc.f1 > 60 and fc.f1 <= 100): table.row2 = getvalueField(sum row1.f2)