I am relatively new to python and I am trying to build a tool within python toolbox with GPSQLExpression as parameter.
I am having trouble with populating its field and value list. Below is part of my code, I put it in updateParameters.
Feature classes in geodatabase were made from OSM data.
def getParameterInfo(self):
"""Define parameter definitions"""
p1 = arcpy.Parameter(
displayName = "In gdb",
name = "in_gdb",
datatype = "DEWorkspace",
parameterType = "Required",
direction = "Input")
p2 = arcpy.Parameter(
displayName = "Geometry type",
name = "userinput",
datatype = "GPString",
parameterType = "Required",
direction = "Input",
multiValue = False)
p2.filter.type = "ValueList"
p2.filter.list = ['pt','ln','ply']
p3 = arcpy.Parameter(
displayName ="Selected fc",
name = "fcs_of_gdb",
datatype = "GPFeatureLayer",
parameterType = "Required",
direction = "Input",
multiValue = True)
p4 = arcpy.Parameter(
displayName = "Pick counties",
name = "colli",
datatype = "GPString",
parameterType = "Required",
direction = "Input",
multiValue = True)
p4.filter.type = "ValueList"
p5 = arcpy.Parameter(
displayName = "Select Feature Layer",
name = "fl_gdb",
datatype = "GPFeatureLayer",
parameterType = "Required",
direction = "Input")
p6 = arcpy.Parameter(
displayName = "SQL Expresssion",
name = "expres",
datatype = "GPSQLExpression",
parameterType = "Required",
direction = "Input",
multiValue = False)
p6.parameterDependencies = [p5.name]
p = [
p1, p2, p3,
p4, p5, p6
]
return p
Below I attached 2 screenshots from ArcGIS Pro. When I type for ex. highway or any other field name from OSM data scheme - it is fine, no errors, but when I try to write whole SQL expression, error shown below appears and also I cannot compose SQL expression using drop down list, because it is empty.
Any ideas how to write whole SQL expression?
Below error message:
ERROR 000800 The value is not a member of OBJECTID | Shape | highway | building | natural | waterway | amenity | landuse | place | railway | boundary | power | leisure | man_made | shop | tourism | route | historic | aeroway | aerialway | barrier | military | geological | OSMID | osmuser | osmuid | osmvisible | osmversion | osmchangeset | osmtimestamp | osmMemberOf | osmTags | osmSupportingElement | osmMembers | Shape_Length.
EDIT:
Removed meaningless code, fixed bugs. Now code is working properly.
{}
and" "
buttons that enables you to format any highlighted text nicely.