Can't get the where clause in Select layer by attribute working!

المشرف العام

Administrator
طاقم الإدارة
I am trying to develop a script that searches for a particular ID in a user selected field. To this end I have used the select layer by attributes tool to search for a derived number in a field specified by the user.I cannot, however, after numerous attempts, get the where clause right. I have posted my latest attempt below:

import arcpyfrom arcpy import envwork_space = "L:\\DRAINAGE\\D_GROUP6\\STAFF\\CJE\\EDRNb\\EDRN_holding.gdb"env.workspace = work_spacearcpy.env.overwriteOutput = Trueselected_li = "L:\\DRAINAGE\\D_GROUP6\\STAFF\\CJE\\EDRN_holding.gdb\\EDRN7\\EDRN_LINK"OB_ID = "OBJECTID_1"rows = arcpy.SearchCursor(selected_li)for row in rows: id_LCC = row.getValue(OB_ID) id_TNDE = row.getValue("TO_DRNNODE") if id_TNDE == " " or id_TNDE == None: arcpy.MakeFeatureLayer_management(selected_li, "feature_layer10") arcpy.SelectLayerByAttribute_management ("feature_layer10", "NEW_SELECTION", '"' + str(OB_ID) + '" =' + "'" + str(id_LCC) + "'")So, if anyone has any ideas please do let me know.



أكثر...
 
أعلى