Select to view content in your preferred language

Python Script tool

605
2
09-25-2023 10:07 AM
abhishek_choudhary
Occasional Contributor

I have written a scripting tool for first time using python where I am filtering the feature set of a feature layer by applying filters on the fields in the attribute table of a feature Layer Also, Providing a feature layer as a parameter and input field having datatype Value Table and to perform filtering on the Feature Layer I need to generate SQL expression for which I need the data Type of particular field .
Is this approach fine or should I implement it in any other way

image.pngimage.png

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi @abhishek_choudhary ,

For your second parameter, you can create it as type Field and set the Dependency to the InputFeatureLayer (as you currently do).  This will provide a dropdown to select the field:

JakeSkinner_0-1695666687346.png

 

0 Kudos
JohannesLindner
MVP Frequent Contributor

You can easily create SQL expressions with the SqlExpression parameter type. Just set its dependency to the layer and ArcGIS automatically fills out the possible fields and values.

JohannesLindner_0-1695320456016.pngJohannesLindner_1-1695320511918.pngJohannesLindner_2-1695320549075.png


Have a great day!
Johannes