Setting Parameter Data Type/Properties

487
2
01-09-2013 06:34 AM
MikeKnowles
New Contributor
I have a script which I've added to a toolbox in ArcGIS 10.0.  The script asks the user for a geodatabase (I'm creating and storing rasters from a NetCDF file) and either uses an existing geodatabase or creates a new one if it doesn't exist.  In adding the script to a toolbox the problem I'm having is what parameter data type to select and/or what parameter properties need to be set to allow me to put in a geodatabase that doesn't exist.

The script runs if an existing geodatabase is selected but not if a new one is selected.

Thanks,
Mike
Tags (2)
0 Kudos
2 Replies
T__WayneWhitley
Frequent Contributor
Probably 'workspace' type... don't know what is in your script, can you post it?
Have you already entered the lines in your script to fetch the needed parameters, GetParameterAsText, I am assuming?
0 Kudos
curtvprice
MVP Esteemed Contributor
I have a script which I've added to a toolbox in ArcGIS 10.0.  The script asks the user for a geodatabase (I'm creating and storing rasters from a NetCDF file) and either uses an existing geodatabase or creates a new one if it doesn't exist.  In adding the script to a toolbox the problem I'm having is what parameter data type to select and/or what parameter properties need to be set to allow me to put in a geodatabase that doesn't exist.

The script runs if an existing geodatabase is selected but not if a new one is selected.


The only way you can do this and have the validation not delete the output geodatbase before the script begins is to provide two parameters: 1) an existing folder (Input,Folder,Required) where the geodatabase exists and 2) a geodatabase name (Input,Folder,String) (to which you can add a ".gdb" to within your script [or validation code] if it isn't provided).  If the geodatabase does not exist, your script must create it using the CreateFileGDB tool.

If you want your script to return the gdb as an output (say, for modelbuilder to chain into the next tool) you put it last as a parameter of type (Derived,Workspace) and return the path in your script using arcpy.SetParameterAsText() in your script.
0 Kudos