AnsweredAssumed Answered

Invalid Exception on SelectLayerByAttribute command line????

Question asked by MLCouden on Apr 25, 2013
Latest reply on Apr 29, 2013 by MLCouden
It's running through my code now but when it gets to the SelectLayerByAttribute line it says Invalid Expression. This is what I'm trying to get it to do. Once it finds the missing values I need the program to select or show the missing values from the flayer or AADT layer in the mxd.

import arcpy, traceback  mxd = arcpy.mapping.MapDocument(r"K:\TASS\2 - GEO-DATA PROCESSING SUPPORT\MICHELLE'S WORK_ENTER NOT!!\Work Folder\Python Programming\Wayne's Tools\Abilene_Base_Map.mxd") lstLayers = arcpy.mapping.ListLayers(mxd)  flayer = arcpy.mapping.ListLayers(mxd, "AADT")[0] alayer = arcpy.mapping.ListLayers(mxd, "AADTAnnoLabel")[0]  FRows = arcpy.SearchCursor(flayer) ARows = arcpy.SearchCursor(alayer)  ffields = arcpy.ListFields(flayer, "", "FLAG") afields = arcpy.ListFields(alayer, "", "TFLAG")  FList = [] AList = []  for row in FRows:     Fvalue = row.getValue("FLAG")     FList.append(str(Fvalue))  for row in ARows:     Avalue = row.getValue("TFLAG")     AList.append(str(Avalue))  matched = set(FList) & set(AList)  for x in matched:     exp = "ID = " + x     arcpy.SelectLayerByAttribute_management(flayer, "ADD_TO_SELECTION", exp)     arcpy.SelectLayerByAttribute_management(flayer, "SWTCH_SELECTION")