1

I've made a few Python tools for ArcGIS lately and haven't had to use this idea in my tools until now. I am making a looong tool that will deal with 13 different districts worth of data. I want the user to select which district the data they are processing comes from. I want it to be a drop down menu that the user selects from and then that will help to assign attribute data properly.

I have looked around online, but haven't found any resources that might help me accomplish this, and it might just be a really easy thing to do, can anyone help me out here?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Aug 24, 2015 at 19:34
1
  • 1
    Should the user be able to select multiple values? If so, you want to create a multivalue parameter and my answer to this question should have a simple example. If not, you would set it up similarly, but without making it multivalue (the filter should cause it to have a drop down). Commented Aug 24, 2015 at 19:42

1 Answer 1

4

This can be accomplished by adding a value list filter to the tool parameter.

  1. Right click the tool in the catalog window and select properties, then navigate to the 'Parameters' tab.

  2. Highlight the parameter you would like to add the value list to, navigate to the 'Parameter Properties' box and select 'Value List' from the drop-down menu in the 'filter' property. enter image description here

  3. Now simply add the values to the list and apply. the tool dialog should now have a drop-down with the values.

answered Aug 24, 2015 at 19:44
3
  • Hey man, thanks for your help on this problem. that was exactly what I was looking for and im surprised I couldn't find it! I have since tried running my code and it is giving me an error with that parameter - Traceback (most recent call last): File ... line 17, in <module> irrdist = arcpy.GetParameterAsText(3) ... line 598, in GetParameterAsText return gp.getParameterAsText(index) File "... line 224, in getParameterAsText self._gp.GetParameterAsText(*gp_fixargs(args, True))) RuntimeError: Object: Error in getting parameter as text - Do you know what might be causing this? Commented Aug 24, 2015 at 20:45
  • @BenFerence It's hard to say without more info. You could always ask a new question and include the error above and some snippets of code, that would be your best bet. Commented Aug 25, 2015 at 12:23
  • Perhaps you need to use the 'somevariable.valueAsText' property after the variable on the line the error points to. It could be that the value is being returned as a geoprocessing object instead of a string. This is a wild stab in the dark because as Chris R said, we need to see more of your code to be sure. Commented Aug 25, 2015 at 14:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.