I have three tool parameters;
- an input point feature class,
- a (multivalue) list of fields derived from the input feature class and
- an output file location to export to Excel.
I have filtered the fields derived from the feature so only Short, Long, Float, Double, Text and Date types are accepted. I would like to set the tool validation so that if a point feature class is selected that doesn't contain any fields of said types, an error message will show by the input point feature class parameter. The below code shows where I am at currently however does not present an error message.
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
if self.params[0].altered and str(self.params[0].value) != "":
if not self.params[1].value:
self.params[0].setErrorMessage("The selected feature class does not have any fields. Please check and try again.")
else:
self.params[0].clearMessage()
return
No comments:
Post a Comment