I'm trying to check the "fiberEquipment" table against the "material_cd" table and find instances where there are discrepancies. E.G -- Checking that "material_cd" 10785823 in "fiberEquipment" has all the correct values associated with it (inputportcount, outputportcount, inputblockcount, etc.) per the "material_cd" table.
The code I'm using below takes the values from the "fiberEquipment" table, inserts them into a dictionary and than uses a search cursor invoking the dictionary elements to check for discrepancies. The code currently works without any errors, but the logic seems to be flawed, as it's not doing anything when all fields match.
# Fiber Equipment/Material Catalog fields
matcd_fields = ["material_cd", "inputportcount"]
fibequip_fields = ["material_cd", "inputportcount", "outputportcount", "inputblockcount", "outputblockcount", "objectid"]
# Compare FIBEREQUIPMENT table to Material Catalog table and determine which objectid's have records that aren't matching
ipc = {} # 'material_cd' : 'inputportcount'
ipcOID = {} # 'material_cd' : 'objectid'
opc = {} # 'material_cd' : 'outputportcount'
opcOID = {} # 'material_cd' : 'objectid'
ibc = {} # 'material_cd' : 'inputblockcount'
ibcOID = {} # 'material_cd' : 'objectid'
obc = {} # 'material_cd' : 'outputblockcount'
obcOID = {} # 'material_cd' : 'objectid'
with arcpy.da.SearchCursor(fiberEquipment, fibequip_fields) as cursor:
for row in cursor:
ipc[str(row[0])] = row[1]
ipcOID[str(row[0])] = row[5]
opc[str(row[0])] = row[2]
ipcOID[str(row[0])] = row[5]
ibc[str(row[0])] = row[3]
ibcOID[str(row[0])] = row[5]
obc[str(row[0])] = row[4]
obcOID[str(row[0])] = row[5]
objectID = []
with arcpy.da.SearchCursor(material_catalog, matcd_fields) as cursor:
for row in cursor:
if ipc[str(row[1])] == row[1]:
objectID.append(ipcOID[row[0]])