Updating field in feature class with Search and Update Cursor:Stop Iteration error

المشرف العام

Administrator
طاقم الإدارة
I would like to update a field in a single feature class by a.) searching for a field where the values are not blank and b.) searching for a field where the values are blank.

A typical scenario of this update would occur if there are two service requests in one feature class with the same service request number with one being updated. When the updated feature is in the feature class, it does not maintain all of the same values that the previous feature class held. The one field that I would like to update is VehicleNam. So if I have a feature class where SR # 555 appears twice, as OID1 and OID2, but only OID1 has a value for VehicleNam I would like to update the VehicleNam field in OID2 as well. Here is the script that I have so far, however an error is being thrown at line 5. I am using ArcGIS 10.2.2

with arcpy.da.UpdateCursor(fc, ["VehicleNam"],"""VehicleNam ''""") as ucursor: with arcpy.da.SearchCursor(fc, ["VehicleNam"],"""VehicleNam = ''""") as scursor: for srow in scursor: svalue = srow[0] urow = ucursor.next() # instead of a full "for urow in ucursor" loop each time urow[0] = svalue ucursor.updateRow(urow)

Runtime error Traceback (most recent call last): File "", line 5, in StopIteration



أكثر...
 
أعلى