I am doing a bulk spatial join on gps points by assigning the attributes within a site buffer to the points themselves. Unfortunately, there are 4 different types of GPS points. Within that, I only want to populate the most frequently occurring points(categories). I have it set up with a stats table ordered by frequency. From there, I am inserting the top 3 into a list, and then assigning as such. My problem is that because the ID field for the GPS points has a different name for each type. When I go to grab the field from the search cursor, I'm forced to use an item.{variable} rather than item.fieldname. It doesn't like that at all! Is there a better way I could grab the field name from the table?Any help would be greatly appreciated. I know it's a lot of code, but as I said, I'm just trying to find a way to grab the item.Columnname value from within the cursor.
towerfield = ["RNW","Cell","Scramble1","ServSN"]
def PQid():
for value in towerfield:
print towerfield.index(value),value
PQnum = input("Which field identifier is this carrier using?")
PQKey = towerfield[PQnum]
return PQKey
Columnname = PQid()
arcpy.Statistics_analysis("FC_lyr", "F:/GIS Data/Drive Testing.gdb/stats", [["Device","COUNT"]], Columnname) #draw stats from inside feature
statstable = "F:/GIS Data/Drive Testing.gdb/stats"
result = int(arcpy.GetCount_management(statstable).getOutput(0))
print result
Scursor = arcpy.SearchCursor("F:/GIS Data/Drive Testing.gdb/stats")#, "","", Statscolumn + "; \"FREQUENCY\"", "COUNT_Device") #allow searching of stats table
currentState = ""
mylist = []
Scursorfields = arcpy.ListFields(statstable)
for item in Scursor:
if arcpy.Exists("SelectedSite"):
rt = (item.Frequency, str(item.Columnname),)
mylist.append(rt)
mylist.sort()
mylist.reverse()