I'm trying to write a script that will check a column for data compliance with domain values
If the data does not match, then the column name and row identification number are printed
fc = 'D:\Arcgis\New Personal Geodatabase.mdb\TEST'
domain_2 = arcpy.da.ListDomains("D:\Arcgis\New Personal Geodatabase.mdb")
field_1 = 'ID_COD'
fields = arcpy.ListFields(fc)
cursor = arcpy.SearchCursor(fc)
for field in fields:
if field.domain:
print field.name
for domain in domain_2:
if field.domain == domain.name:
for val in domain.codedValues.keys():
a=set()
a.add(val)
for row in cursor:
b=row.getValue(field.name)
if b not in a:
print (row.getValue(field_1))
But for some reason, the script does not work correctly: the first column shows all erroneously filled cells and all the rest only the column name:
STATUS #column name
1111111 #line identification number
2222222 #line identification number
COMPANY_MANAGER
COMPANY
Help find the error