AnsweredAssumed Answered

ArcGIS tool validation: How to add an error message to a parameter if a seperate multivalue parameter is empty

Question asked by howeitzer on Oct 30, 2014

I have three tool parameters;

  1. an input point feature class,
  2. a (multivalue) list of fields derived from the input feature class and
  3. 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. How do we use multivalue parameters in the validation script of a tool?


  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:
.params[0].setErrorMessage("The selected feature class does not have any fields. Please check and try again.")