I'm quite new in ArcPy.

I'm able to get a list of values from a Layer Feature and for specific field, however I would like to edit that attribute after is displayed on the screen. Because the value is inside the list if I type another value is telling me is not in range in the list, so raises an error.

Is it possible after geting the list of values modify directly into the parameter value?

I was thinking that if the value is not in the list, then type your new value as an input on the same parameter box without raising an error.

This is my Validation Toolbox python code at the moment:

import arcpy
class ToolValidator(object):
  """Class for validating a tool's parameter values and controlling
  the behavior of the tool's dialog."""

  def __init__(self):
    """Setup arcpy and the list of tool parameters."""
    self.params = arcpy.GetParameterInfo()

  def initializeParameters(self):
    """Refine the properties of a tool's parameters.  This method is
    called when the tool is opened."""

  def updateParameters(self):
    fc = "my_feature_class"
    rows = arcpy.SearchCursor(fc)
    if self.params[0].value: 
      self.params[0].filter.list = sorted (list(set(r.getValue('my_field')for r in rows)))
      del rows
      self.params[0].filter.list = []

closed as unclear what you're asking by PolyGeo Mar 13 '18 at 3:40

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What the datatype for params[0]? You might need to include your code for getParameterInfo. My guess is you'll need to play with that. – Richard Morgan Mar 8 '18 at 12:41
  • Needs to be string the datatype for params[0] – Mariano Mar 8 '18 at 13:14
  • What is the precise error that you are receiving? – PolyGeo Mar 11 '18 at 22:10