I'm making a python toolbox and it has an input parameter of type GPFeatureLayer. Let's call it my_param.

In updateParameters when my_param.altered, its value is added to a value table. Then I'd like to set my_param.value = None, so that the selection is blanked out and same value could be immediately selected again.

As it stands right now, setting my_param.value = None means that that layer cannot be chosen again.

Why is this happening, and how can I achieve what I'm trying to do?

Here is some example code for you to use:

def getParameterInfo(self):
    my_param = Parameter(displayName='My Param', 
    return [my_param]

def updateParameters(self, parameters):
    my_param = parameters[0]
    if my_param.altered:
        (function that appends my_param.value to another table, not important for this problem)
        my_param.value = None
  • 1
    What's the entire code block under updateParameters()? It's unclear what you are doing with value tables and the altered property.
    – Paul
    Commented Nov 10, 2015 at 2:18
  • 1
    @Paul I made a video to try to explain it better. Thank you very much. Commented Nov 12, 2015 at 2:01
  • @user195254, that's quite a complex python toolbox! I'll investigate it further in my free time.
    – Paul
    Commented Nov 12, 2015 at 2:36
  • 1
    Hmm, since you are setting the value to None, my guess is that a value might still actually be present, you just can't see it because it's None? One workaround that might work....instead of setting it to None set it to an empty space, and change your if statements to check for that? Gah..
    – Paul
    Commented Nov 12, 2015 at 2:50
  • @Paul I've tried also setting the value to an empty string and now a space character. The former behaves exactly as setting it to None does, and the latter throws this error: "Dataset does not exist or is not supported." I even tried setting my_param (or target_table_layer_selector, as it is called in my actual code) to equal a new parameter instance entirely, but the change doesn't take. Commented Nov 12, 2015 at 22:19

2 Answers 2


In addition to checking the altered flag I'd also evaluate the value of the parameter. You could use valueAsText or value, but valueAsText is slightly faster (especially if working with a layer).

def updateParameters(self, parameters):
    my_param = parameters[0]
    if my_param.altered and my_param.valueAsText:
        #(function that appends my_param.value to another table, not important for this problem)
        my_param.value = ''


Now the parameter value will only be reset if the parameter has been altered, and is not blank.

  • I'm intrigued about value vs. valueAsText. How noticeable is it when say, changing the parameter?
    – Paul
    Commented Nov 10, 2015 at 22:30
  • In Desktop, hardly at all. In Pro, it's a bit more obvious.
    – DWynne
    Commented Nov 10, 2015 at 22:33
  • Okay so I've tried this and I have the same problem. Whenever you select a value for that parameter, the value becomes "blanked out" and you cannot select it again. Initially, it will still appear on the list of features you can select (even though you can't select it even if you click on it), but then if you change a value for a different parameter and look at this parameter's value options again, the value is no longer there. Commented Nov 11, 2015 at 20:32
  • So, you click on the pulldown, the parameter provides some choices. You pick one. Then you click on the pulldown again and that choice is no longer there?
    – DWynne
    Commented Nov 11, 2015 at 20:59
  • Yes, it's a little difficult to explain in text so I made this video to try to show everyone exactly what I'm talking about. Thanks for taking a look, I really appreciate it. Commented Nov 12, 2015 at 1:59

I figured out how to deal with it. It's not a perfect solution but it works. Set parameter datatype = 'GPString' instead of 'GPFeatureLayer' and then when you want to blank it out by setting value = '', you then have to reset my_param.filter.list = [(option1), (option2), ...]. So, write a method that returns all the options that you want in a list of strings that you can set my_param.filter.list to. For example, here's my method that returns all point feature layer names from the map:

def point_feature_layer_names(self):
    point_layer_names = []
    mxd = MapDocument('CURRENT')
    df = mxd.activeDataFrame
    for lyr in ListLayers(mxd, '', df):
        desc = Describe(lyr.name)
        if desc.shapeType == 'Point':
    del mxd
    return point_layer_names

Your Answer

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

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