arcpy; Select by attribute with an If, then statement

المشرف العام

Administrator
طاقم الإدارة
I am looking for some advice on how to construct an if, then statement based on a select by attribute SQL query or some other method (search cursor?).

I am asking users to input a unique ID (arcpy.GetParameterAsText(0)), based on that ID I want to search a shapefile field for that value (arcpy.SelectLayerByAttribute_management or arcpy.SearchCursor?), if it is not found, I want to search a different shapefile. When the Unique ID is found I need to export (arcpy.CopyFeatures_management) and isolate the feature.

I am having trouble trying to find something which will indicate if the unique ID is found in the field or not. This is likely a basic issue to you wizards, but I'm new to the game, thanks a bunch in advance!

I'm essentially looking for something like what occurs with the Verify Expression button event click -> "The expression was verified successfully, BUT NO RECORDS WERE RETURNED".



أكثر...
 
أعلى