AnsweredAssumed Answered

Help With Select by Attribute!

Question asked by Xhosa on Aug 17, 2012
Latest reply on Aug 28, 2012 by Xhosa
Hello

I am having an issue with a simple script. The script runs but not the way I am intending it to. It will not properly export the second conditional. It exports a shapefile but with empty attributes. Any help is greatly appreciated!

# Make a layer from the feature classarcpy.MakeFeatureLayer_management("C:/Chris/ADC_Python.gdb/Boundaries/Nations_Countries", "Countries")   #Select Country from master data layer arcpy.SelectLayerByAttribute_management ("Countries", "NEW_SELECTION", """ "Cntry_Name" = 'Eritrea' """)   # Select the main country boundary    if arcpy.SelectLayerByAttribute_management("Countries", "SUBSET_SELECTION", ' "Shape_Length" >= 27 '):     arcpy.CopyFeatures_management("Countries", "ERT_ADC_main") # Write the selected features to a new featureclass     print ("Exported Main!") #Select out the islands boundary elif arcpy.SelectLayerByAttribute_management("Countries", "SUBSET_SELECTION", ' "Shape_Length" <  26 '):     arcpy.CopyFeatures_management("Countries", "ERT_ADC_islds") # Write the selected features to a new featureclass     print ("Exported Islands!") else:     print ("FAILED TO EXPORT TRY AGAIN!")

Outcomes