I am working on an ArcGIS (9.3) Python script. One of the inputs is a list of features. For each feature, I need to select a corresponding field. Setting the parameter to MultiValue gives a nice table in the UI for all the features being processed. How do I add another column to the MultiValue table to select a field for each feature?

Cross-posted: http://forums.arcgis.com/threads/30907-MultiValue-Parameter-with-Multiple-Columns

Esri's Answer from the ArcGIS forum:

Unfortunately, the solution for this was implemented just recently for 10.1 with ValueTable inputs for script tools. You will need to have two multivalue parameters with some custom validation to make this work for 9.3.1.

  • If it is the generation of multivalue choice list you are interested in - I've seen this Esri blog post recently, it might be helpful. – Alex Tereshenkov Jan 31 '13 at 21:24

I've worked out how to do this albeit in a fairly simple manner. I wanted to create a multivalue parameter where I add many FeatureLayers and then choose an ID field for each layer. I've got it working but I was unable to work how to make the field a drop down list, so a user has to enter a field name manually. Here is the interface:

Example interface

If anyone has managed to crack this problem or some guru from ESRI blesses us with their knowledge I would love to find out how to turn my second column (Site ID) into a drop down, listing specific fields. If you want to see an example of this have a look at the Create TIN tool.

Anyway to create this interface I create a script tool and added a parameter of type feature layer and set it to a multivalue as shown below.

Initial interface setting

I then clicked on the Validation tab at the top and then the Edit button. As this parameter is the 6th parameter in my script tool I updated the following code:

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

    # Get the 6th parameter
    param = self.params[6]
    param.datatype = "Value Table"
    param.columns = [["Feature Layer","Activity Layer"],["Field","Site ID"]]    

This resets the interface into the multi column table that I wanted. When you use GetParameterAsText it returns the following using my example:

pipeline pid;Dredging did

I've done some more research and have created the tool using a python toolbox. It works very well but does have a limitation if you go back and choose another ID. I have posted the code on GeoNet here.


if you are looking for a drop-down list for the Site ID parameter, you can use a code as the following:

 param.filters[1].list = ['pid', 'id']

So, you can create a cursor or use another method to read all the fields of the FC and pass them, as a list, to the previous sentence

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.