ArcGIS 10.0 – How to Populate SQL Options for Parameter in ArcGIS Tool

arcgis-10.0arcgis-desktopparameterssql

In ArcGIS Desktop 10 I am trying to create a tool where individuals can select a variety of records using a SQL expression that is then passed to a calculation. I can add a parameter under the tool, and select SQL expression, but when I click on the SQL expression box its not "populated" by potential fields, and therefore unable to get unique values. I thought this might be because the tool needed to know which .shp file it was calling, so I added a higher level parameter to specify the .shp file, but still no luck, the SQL parameter remains entry.

Best Answer

I was able to get the SQL Expression parameter's dialog to populate by setting its Obtained From property to the input Feature Layer parameter I created:

Script Tool Parameters screenshot Query Builder screenshot

Note that Feature Layer parameters also accept feature classes, e.g. a path to a shapefile or feature class, in addition to the name of a feature layer in the current map document or in the current geoprocessing session. The SQL Expression dialog was populated correctly in both cases for me.

Related Question