AnsweredAssumed Answered

UdateCursor Help

Question asked by Tonyalmeida on Dec 2, 2013
Latest reply on Dec 5, 2013 by Tonyalmeida
Would there be a way to write something that states if there is something with DWELL populate with House, but if it is NULL populate with Mobile home but if it is something else populate it with what is on the Points_2 CPUC field?

Here is my current working code.
import arcpy, time arcpy.env.overwriteOutput = True  arcpy.env.workspace = r"C:\Temp\Defult.gdb" fcTarget = 'Points_1' fcJoin = 'Points_2' fcOutput = 'Points_joined'  arcpy.SpatialJoin_analysis(fcTarget, fcJoin, fcOutput, 'JOIN_ONE_TO_ONE', 'KEEP_COMMON')  curR = arcpy.SearchCursor(fcOutput, '', '', '', 'AddressID A') curW = arcpy.UpdateCursor(fcTarget, '', '', '', 'AddressID A')  # init rowW and rowR rowW = curW.next() rowR = curR.next()  while rowR:     currentAddress = rowR.AddressID     print 'current add: ' + currentAddress     while rowW.AddressID != currentAddress:         rowW = curW.next()     if rowR.CPUC == 'DWELL':         rowW.FacltyType = 'Single Family Home'         rowW.APA_CODE = '1110'         rowW.StructType = 'Primary, Private'         rowW.Verified = 'Yes, GRM, TA, ' + time.strftime('%m-%d-%Y')         rowW.Status = 'Active'         rowW.StructCat = 'Residential'     else:         rowW.FacltyType = 'MobileHome'         rowW.APA_CODE = '1150'         # put any additional conditional field statements here      # put any 'global' field statements here (applies to both SF/MH)             curW.updateRow(rowW)     rowR = curR.next()  # changed the delete statement, targeting the cursor objs (rather than the row objs) if curW:     del curW if curR:     del curR

Outcomes