In this code I'm trying to create a join in ArcGIS Pro between two separate feature layers. Then look for changes in the data between the two layers and do something when it finds the changes. However, when I try to do the join in the Script, the join doesnt work, BUT if i run that same piece of code for the join in the Python window in ArcGIS Pro the join work. The Script does not fail either it says it successfully completed, but there is no join.
I'm sure it's something simple. Hope someone can help!
Thanks.
<SPAN class="comment token"># Brings in data to map </SPAN>
<SPAN class="comment token">#sets the map and project location </SPAN>
aprx <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mp<SPAN class="punctuation token">.</SPAN>ArcGISProject<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"CURRENT"</SPAN><SPAN class="punctuation token">)</SPAN>
m <SPAN class="operator token">=</SPAN> aprx<SPAN class="punctuation token">.</SPAN>listMaps<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Map4"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="comment token">#Adds the downloaded parcels</SPAN>
m<SPAN class="punctuation token">.</SPAN>addDataFromPath<SPAN class="punctuation token">(</SPAN>outputFC<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#arcpy.MakeFeatureLayer_management(outputFC, "testingg_3")</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddJoin_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"NEW"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"APN"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"testingg_3"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"APN"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"KEEP_COMMON"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#arcpy.management.AddJoin("NEW", "APN", "testingg_3", "APN", "KEEP_COMMON")</SPAN>
s <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'NEW'</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> s<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> row<SPAN class="punctuation token">.</SPAN>getValue<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"testingg_2.Status_5"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">!=</SPAN> row<SPAN class="punctuation token">.</SPAN>getValue<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"testingg_3.Status_5"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>AddMessage <SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">.</SPAN>getValue<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"testingg_2.APN"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#print (row.getValue("testingg.APN"))</SPAN>
<SPAN class="keyword token">del</SPAN> s
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>