AnsweredAssumed Answered

ToolValidator: Automatically filling list with available fields?

Question asked by MartinHvidberg on Aug 30, 2012
Latest reply on Aug 30, 2012 by JScheirer-esristaff
I'm making a tool that harvest and process information from an (attribute) field in a feature layer.
I would like to interface to look something like this:

[ATTACH=CONFIG]17368[/ATTACH]

User should select 1) a feature layer 2) a (attribute) field in that feature layer.

So far so good...
I would like the ToolValidation to automatically populate the second dropdown with a list of the field that are available in the feature class that was selected in the first field.
I have tried with the validation below, but it doesn't work :-(


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."""     self.params[1].value = arcpy.ListFields(self.params[0].value, None, None)     return


I assume that arcpy.ListFields return a python style list, and that is not a valid input type to self.params[1].value

Can anybody please provide an example or suggestion to how I can code a TollValidator that automatically populates the second dropdown with a list of what fields may be available in the feature class that is selected in the first dropdown box.

Best regards
Martin

Attachments

Outcomes