Hi,
I'd like to offer to final users of a python script tool the option to work with a constant value (as double) or a raster dataset.
I've thought about defining 2 parameters ( double and raster dataset) but I dont know how to disable the parameter not selected by the user.
Is that possible? Is there other solutions?
Thanks in advance
Solved! Go to Solution.
Mar,
Take a look at this topic, it describes how to perform the validation you are looking for.
Customizing Script tool behavior
The first example on this page shows you what you need to do in the updateParameters method:
def updateParameters(self):
# If the option to use a weights file is selected (the user chose
# "Get Spatial Weights From File"), enable the parameter for specifying
# the file, otherwise disable it
#
if self.params[3].value == "Get Spatial Weights From File":
self.params[8].enabled = 1
else:
self.params[8].enabled = 0
You will want to change this slightly for your workflow.
Mar,
Take a look at this topic, it describes how to perform the validation you are looking for.
Customizing Script tool behavior
The first example on this page shows you what you need to do in the updateParameters method:
def updateParameters(self):
# If the option to use a weights file is selected (the user chose
# "Get Spatial Weights From File"), enable the parameter for specifying
# the file, otherwise disable it
#
if self.params[3].value == "Get Spatial Weights From File":
self.params[8].enabled = 1
else:
self.params[8].enabled = 0
You will want to change this slightly for your workflow.
Thanks Russell, I passed over the validation section!!!