I am using ArcGIS Desktop 10.4.
I am trying to iterate a process through a Feature Class to calculate individual (and unique) values in a particular field. I can calculate the field just fine, but it ends up recalculating the new unique value for all of the features in the feature class instead of each individual row. I cannot convert to feature layer or layer file because I need to add the data to the current Feature Classes without adding more Feature Class to that geodatabase. (I am already iterating it through 231 Feature Classes and do not need more...) I have tried Search Cursor already, and could not find any other code because arcpy.IterateFeatureSelection() is meant for model builder and not python. I was expecting my update cursor in "fc_update in fc_updates" would provide that service, but it did not. Otherwise it prints and defines the data exactly how I intent to use it.
I left out the rest of my code as it is not pertinent to the part that needs to select the data.
My code is below:
fc_updates = gp.UpdateCursor(fc) for fc in fcs: if fc.startswith("GP_"): print "Start Feature Class at: " + str(datetime.datetime.now().time().strftime('%H:%M:%S')) print "Feature Class: " + fc #arcpy.AddField_management(fc, field_name,"Short") for fc_update in fc_updates: obj_id = str(fc_update.OBJECTID) flt_desig = str(fc_update.flt_line) imag_start = str(fc_update.Start_Imag) imag_end = str(fc_update.End_Imag) n = n + 1 print "-"*30 print "Attribute Information . . ." print "image start = " + str(imag_start) print "image end = " + str(imag_end) imag_entry = (str(imag_start) + "," + str(imag_end)).split(",") print "image entry = " + str(imag_entry) start = int(imag_entry) end = int(imag_entry) express1 = start-n express2 = start+n print (str(flt_desig), str(imag_start), str(imag_end)) print "-"*30