3

I'd like the red x to show in the corner of the tool if they try to load the wrong feature class. That way we can prevent possible errors with the output. I've tried using the error messages arcpy functions but I only get the error message function after I select ok for the tool to run.

def getParameterInfo(self):
# First parameter
in_features = arcpy.Parameter(displayName="Data",name="Data",datatype="DEFeatureClass",parameterType="Required",direction="Input")
messages.addMessage("Must Use Data Feature Class!!!!!")
clearMessage()
return [param0]

This will set the parameters so that any other feature class that isn't named "Data" can not be used. However, it gives the following error message. I would prefer to be able to customize the red x message saying that you can only input the "Data" feature class. enter image description here

setErrorMessage

The Set Error Message also gives the invalid drop item warning. I'd rather have it as the red x in the corner and the pop up box.

2

You are referring to the tool parameter validation. This can be achieved with tool validator class either when you use the script tools or pure Python tools (for those you work directly with the parameters in the script).

  • I've looked at the tool validator class and I haven't been able to get it to work. Do you have any examples of it working? – user3767931 Aug 25 '15 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.