Select to view content in your preferred language

Output parameter for Feature Class only

782
3
11-10-2010 05:23 AM
PaulSchneider
Regular Contributor
While adding a script as a tool, I'm specifying parameters for a Python script.  One of my outputs is a feature class; it cannot be a shapefile since the field names are cropped and the script will fail.

Specifying the data type as 'Feature Class' still allows the user specify a shapefile as output, how can I ensure that the only possible output is a geodatabase feature class?

Thanks-

Paul
0 Kudos
3 Replies
LoganPugh
Frequent Contributor
You could edit the ToolValidator code to look for ".shp" at the end of the value of the output feature class parameter and if found, set an error message. Otherwise I do not think there is a filter that allows only geodatabase feature classes.
0 Kudos
curtvprice
MVP Esteemed Contributor
While adding a script as a tool, I'm specifying parameters for a Python script.  One of my outputs is a feature class; it cannot be a shapefile since the field names are cropped and the script will fail.

Specifying the data type as 'Feature Class' still allows the user specify a shapefile as output, how can I ensure that the only possible output is a geodatabase feature class?


In the Parameters tab of the script tool properties, you can specify Shapefile as the output data type. This should work.
0 Kudos
LoganPugh
Frequent Contributor
Yep, but I believe he's trying to do the opposite. Disallow the user from specifying a shapefile as the output, and allow geodatabase feature classes only.

It might be best to fix the underlying cause for the script failing however, as it would be good practice to have your script output to any feature class, not just GDB feature classes.
0 Kudos