AnsweredAssumed Answered

Set Function with addtional field printed

Question asked by LarryAdgate on Feb 9, 2015
Latest reply on Feb 9, 2015 by LarryAdgate

Some help on this please, Thanks

Script work works great for finding Facilityid numbers not found in “b” or final =a-b. But to make the script more useful an additional field or
“NAME” should be printed in conjunction with the Facilityid number or “FACILITYID & NAME” and this is where I need some help. The “NAME” field contains text (ex:“Redondo Tank”) and is difficult to add or subtract and the set function works perfect for my task.



Larry Adgate    


# Import arcpy module
import arcpy

# Local variables:
Index = "C:\\Projects\\UpdatePlantFacilityIndex.mdb\\FacilityIndex2013"
Arden_ns = "C:\\Projects\\UpdatePlantFacilityIndex.mdb\\UpdatePlantFacilityIndex\\Network"


a = set(r[0] for r in arcpy.da.SearchCursor(Index, ["FACILITYID"]))
a1 = set(r[0] for r in arcpy.da.SearchCursor(Index, ["NAME"])) #Addition field data to accompany FacilityID
b = set(r[0] for r in arcpy.da.SearchCursor(Arden_ns, ["FacilityID"]))


final = a+a1-b


print "Arden System Discrepency: {0},".format(", ".join(sorted(final)))


#error Message:    final = a+a1-b
#error message: TypeError: unsupported operand type(s) for +: 'set' and 'set'