For the script as below, can I directly use fieldname, rather than newName in SQL? (so delete newName = arcpy.AddFieldDelimiters("C:/Data", fieldName) ...) If not, why? When to use AddFieldDelimiters? Any difference to ValidateFieldName? Thanks indeed!! import arcpy from arcpy import env fieldName = arcpy.GetParameterAsText(0) wkspace = arcpy.GetParameterAsText(1) in_features = arcpy.GetParameterAsText(2) out_feat_class = arcpy.GetParameterAsText(3) stateVal = arcpy.GetParameterAstext(4) # AddFieldDelimieters will return a field name will the proper # field delimiters for the workspace specified. # newName = arcpy.AddFieldDelimiters("C:/Data", fieldName) # Use delimited field for Select tool SQL expression # sqlExp = newName + " = " + stateVal env.workspace = wkspace arcpy.Select_analysis(in_features, out_feat_class, sqlExp)
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.