Hello to everyone:I have some dificulties to find the correct syntax of the where_clause in a selection process:Both of this two possibilies give me an error.wheresatz='"CLAVE"='+nummapawheresatz=""" "CLAVE" = """ + nummapanummapa is an integer value.Perhaps you may have a look to my code below.Thank you in advance.Anika_______
import arcpy
from arcpy import env
import os
vRutaResultado = "D:\\geodatos\\temp_capascorte\\"
vRutaResultado2 = "D:\\geodatos\\temp_capascorte\\shp\\"
try:
env.workspace = "D:\\mapas\\Topografia\\shp"
rows = arcpy.SearchCursor("malla_25000.shp")
for row in rows:
row = rows.next()
nummapa = int(row.getValue("CLAVE"))
print nummapa
#wheresatz='"CLAVE"='+nummapa
wheresatz=""" "CLAVE" = """ + nummapa
print wheresatz
out_feature_class = vRutaResultado2+"m25"+str(nummapa)+".shp"
##where_clause = '"CLASS" = \'4\''
arcpy.Select_analysis("malla_25000.shp", out_feature_class, wheresatz)
fcList = arcpy.ListFeatureClasses()
for fc in fcList:
if fc <> 'malla_25000.shp':
print "cortanto capa: " + str(fc) + "......"
nomfin = vRutaResultado+str(nummapa)+str(fc)
print nomfin
arcpy.Clip_analysis(fc,out_feature_class, nomfin)
print "Ejecutado"
except:
print "se ha detectado un error que impide ejecutar el script"
print(arcpy.GetMessages(2))