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 <SPAN class="operator token">=</SPAN> dict<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">(</SPAN>r<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">(</SPAN>r<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> r <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"testingg_3"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"APN"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"Status_5"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>UpdateCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"testingg_2"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"APN"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"Status_5"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> hostedfc<SPAN class="punctuation token">[</SPAN>keys<SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">in</SPAN> row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">and</SPAN> row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">!=</SPAN> hostedfc<SPAN class="punctuation token">[</SPAN>values<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"yes"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Am I on the right track? I've spent hours trying to figure this part out.