I have this program to go through layers in an mxd and search for missing values. For Example, it sorts through the layer AADT in the FLAG field and then sorts through the layer AADTAnnoLabel in the TFLAG field to compare for missing values. I am getting a sort fields error. Could someone please explain that to me. What am I doing wrong!! I am not finding help online when I search for it. Thanks!!
Code:
import arcpy
flayer = "AADT"
alayer = "AADTAnnoLabel"
FRows = arcpy.SearchCursor(flayer,"", sort_fields="FLAG A")
ARows = arcpy.SearchCursor(alayer,"", sort_fields="TFLAG A")
FList = []
AList = []
for row in FRows:
Fvalue = row.getValue("FLAG")
FList.append(str(Fvalue))
for rows in ARows:
Avalue = row.getValue("TFLAG")
AList.append(str(Avalue))
matched = set(FList) & set(AList)
for x in matched:
exp = "ID = " + x
arcpy.SelectLayerByAttribute_management(flayer, "ADD_TO_SELECTION", exp)
arcpy.SelectLayerByAttribute_management(flayer, "SWTCH_SELECTION")