AnsweredAssumed Answered

Update Cursor on Join Tables

Question asked by deleted-user-yC5VkbyXzrQR on Jun 27, 2019
Latest reply on Jun 28, 2019 by bixb0012

Hello, 

 

So I'm having a hard time trying to figure how to do this script. I almost have it figured out I'm just missing something. 

 

 I figured out that you can't use CursorUpdate with a join table so I'm doing a work around that I found on other forums. 

 

Trying to do this:

1. Download Parcels from Hosted Feature Layer from ArcGIS Online (completed)

2. Compare the Hosted Feature Layer to our parcel database (exact same dataset). 

3. Find the differences in the "Status" Field and update our database with the new "Status" field from the Hosted Layer.

4. Keep track of what parcels have changed in a list. 

 

Below is what I thought it would work but it prints all yes for every single parcel and not the ones where the Status is differnt. (i'm just using print yes, Not updating them until I get this part figured out)

 

hostedfc = dict([(r[0], (r[1])) for r in arcpy.da.SearchCursor("testingg_3", ["APN","Status_5"])])  
 
 
with arcpy.da.UpdateCursor("testingg_2", ["APN","Status_5"]) as cursor: 
     for row in cursor: 
          if hostedfc[keys] in row[0] and row[1] != hostedfc[values]:
               print "yes"

 

Am I on the right track? I've spent hours trying to figure this part out. 

Outcomes