Select to view content in your preferred language

how to set script to handle error 000800: The value is not a member of <value>.

3041
13
Jump to solution
10-08-2021 09:17 AM
RPGIS
by
Frequent Contributor

 

Hi,

I am working on a custom script tool where the update parameters automatically adjust a list of selectable values. Every time the user selects a value, it is removed from the list of values and returns whichever values remain. This is set up so that either not too many values are selected or a repeat of values is selected. It works, but then this error message appears. Any help on this would be greatly appreciated.

def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""            

        # Update parameter 2 values from list generated from parameter 1 input
        feature_class = parameters[1].value
        TileNumber_field = [field.name for field in arcpy.ListFields(feature_class) if field.name == 'TILE_NUMBER']
        scur = arcpy.da.SearchCursor(feature_class, TileNumber_field)
        parameters[2].filter.list = [row[0] for row in scur]

        Export_values = ['Water', 'Sewer', 'Stormwater', 'Lidar']
        Sub_ListValues = []
        
        # Update parameter 3 value list
        Selected_value = parameters[3].valueAsText

        if Selected_value is None:
            parameters[3].filter.list = Export_values
        else:
            if ';' not in Selected_value:
                parameters[3].filter.list = [value for value in Export_values if value != Selected_value]
            elif ';' in Selected_value:
                converted_str2list = Selected_value.split(';')
                parameters[3].filter.list = [value for value in Export_values if value not in converted_str2list]

return

 

0 Kudos
13 Replies
RPGIS
by
Frequent Contributor

Thanks @DonMorrison1,

Just to clarify, if I poorly did so, is that the values I am trying to enable users to select are to designate which sets of data to extract. This tool is designed to loop through our databases, extract the feature classes needed, and zip the folders.

I will give you example a try and tweak it as needed. I haven't done anything like that so this will be new to me.

0 Kudos
RPGIS
by
Frequent Contributor

Hi @DonMorrison1,

So not quite what I am trying to accomplish but relatively close. What I am trying to accomplish is when the user selects certain values, any remaining values in the list are removed. These values dictate which parts of the main script get executed and which parts are passed. Essentially it is designed so that, depending on the selected values, certain databases are searched through and certain data gets extracted.

0 Kudos
RPGIS
by
Frequent Contributor

Hi @DonMorrison1,

What you provided is definitely close to what I am after. Essentially, if the user selects one of the values from the list, the corresponding code will run.

DonMorrison1
Frequent Contributor

Glad to hear it helped. I was thinking that maybe I should have posted a snippet from the execute function where the code sections are conditioned on the associated checkbox being enabled, but it looks like you got the idea OK

0 Kudos