I'm wondering how I can give different GetParameteres when a certain variable is true.
If a feature class has more than 1 feature in it I want it to use a different GP tool. I know I can do this in the script easily but I want users to enter in parameters in if the feature class has more than 1 feature in it.
You will need to apply Script Tool Validation to the tool. Take a look at the following example:
You could specify something like:
def updateParameters(self): result = arcpy.GetCount_management(self.params.value) if int(result) > 1: self.params.enabled = 1 else: self.params.enabled = 0
Now that I think of it, I'm not sure if this will work because the "
arcpyGetCount_management" will not work on a kmz correct?
If I select a kmz with multiple features in it, can the Validation script run to convert the kmz to a feature layer than use the GetCount function and then have the other parameters come up ?
It can, but you may want to be careful with this approach. From the help:
Called each time the user changes a parameter on the tool dialog box. After returning from updateParameters, geoprocessing calls its internal validation routine.
You will want to make sure the tool is not running the KMZ conversion after each parameter is updated.