Suzanne

Python Code for Setting Obtained from Tool property

Discussion created by Suzanne on Jun 11, 2014
Latest reply on Jul 3, 2014 by Suzanne
Is is possible to set the Obtained from property for a parameter in Validation using python code?

I have populated a string parameter with a list of tables selected in Table View parameters.  If the user selects a table name in the string parameter I would like to populate a Field data type parameter with the list of fields for the selected table.

def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parmater
    has been changed."""
      
    if self.params[0].altered:
      tblList = [""]   
      desc = arcpy.Describe(self.params[0].value)
      tblList.append(desc.name)
      if self.params[1].value:
        desc = arcpy.Describe(self.params[1].value)
        tblList.append(desc.name)
      if self.params[2].value:
        desc = arcpy.Describe(self.params[2].value)
        tblList.append(desc.name)
      self.params[6].filter.list = tblList
      self.params[8].filter.list = tblList
      self.params[10].filter.list = tblList
    if self.params[1].altered:
      tblList = [""]
      if self.params[0].value:
        desc = arcpy.Describe(self.params[0].value)
        tblList.append(desc.name)
      desc = arcpy.Describe(self.params[1].value)
      tblList.append(desc.name)
      if self.params[2].value:
        desc = arcpy.Describe(self.params[2].value)
        tblList.append(desc.name)
      self.params[6].filter.list = tblList
      self.params[8].filter.list = tblList
      self.params[10].filter.list = tblList
    if self.params[2].altered:
      tblList = [""]
      if self.params[0].value:
        desc = arcpy.Describe(self.params[0].value)
        tblList.append(desc.name)
      if self.params[1].value:
        desc = arcpy.Describe(self.params[1].value)
       tblList.append(desc.name)
      desc = arcpy.Describe(self.params[2].value)
      tblList.append(desc.name)
      self.params[6].filter.list = tblList
      self.params[8].filter.list = tblList
      self.params[10].filter.list = tblList

    if self.params[6].altered:
      At this point I would like to populate self.params[7] with a list of fields corresponding to the table selected in
      self.params[6]

     self.params[7] is currently a Field data type

Outcomes