I incorporated the following code into my script from Comparing field values of two feature classes using ArcPy? and it works great but I also need to compare two other fields values (i.e. YEAR & MONTH) from the same two FC's.
There is no problem with the code the way it is, I just need help on modifying the code to check 3 fields' attributes from 2 FC's to see if each row for the three fields contain the same attributes and if so not to copy the row to the target feature class. The fields in each FC do match exactly.
import arcpy
#input feature class
fc2 = r"C:\temp\temp.gdb\fc2"
#target feature class
fc3 = r"C:\temp\temp.gdb\fc3"
#check field
checkField = "SRNumber"
#Get list of values in field from target feature class
checkValues = [r[0] for r in arcpy.da.SearchCursor (fc3, checkField)]
#Get list of fields
fields = [f.name for f in arcpy.ListFields (fc2)]
#Get index of check field
index = fields.index (checkField)
#Create insert cursor for fc3 to allow appending of rows
inCursor = arcpy.da.InsertCursor (fc3, fields)
#Create search cursor to iterate input feature class
cursor = arcpy.da.SearchCursor (fc2, fields)
#iterate
for row in cursor:
#Get value to check
checkValue = row[index]
#Check if value is in target fc
if checkValue in checkValues:
#skip if value is in target fc
continue
#Insert row otherwise
inCursor.insertRow(row)
#Clean up
del cursor
del inCursor