Hello,
I am trying to use arcpy's CalculateField method on a table with a join on it. (it is my understanding that because of this, I can't use update cursors). I know the script is producing the correct results when it comes to calculating the dominant values in the list (confirmed with several print statements throughout the script) but it's just the bit at the very end that is not working the way I expected. When I run the script, only one feature gets calculated with all "Y" in the related records, and all the other features calculate with "N" in the related records.
This is the segment of the script that is giving me trouble. I'm happy to provide the full script if that would be necessary.
with arcpy.da.SearchCursor(stratum_layer, PERC_COVER_FIELD) as cursor:
for row in cursor:
if int(row[0]) in dom_list:
arcpy.management.CalculateField(stratum_layer, DOM_SPECIES_FIELD, "'Y'", "PYTHON3")
print(f"{int(row[0])} is dominant")
else:
arcpy.management.CalculateField(stratum_layer, DOM_SPECIES_FIELD, "'N'", "PYTHON3")
print(f"{int(row[0])} is not dominant")
This was written with Python 3.7 and executed with a script GUI in ArcGIS Pro 2.8.3