Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This might be a simple question, but I haven't been able to find a straightforward answer.

I'm 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

EDIT (I can't answer my own question for 8 hours?): 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."

share|improve this question
    
Jason Scheirer had something to say 4 months later (watch cross+post). –  r.pankevicius Feb 8 '12 at 23:04

2 Answers 2

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"]]    
    return

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

EDIT: 19/2/15

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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