AnsweredAssumed Answered

Disable new entries for a Value Table parameter in python toolbox

Question asked by casti on Apr 3, 2018

Hi,

I'm trying to define a parameter called Landscape layers in a python toolbox that basically would be a table with two columns. Something like this:

 

 

 

 

 

 @property
    def paramLandscapeProducts(self):
        if not self._paramLandscapeProducts:      
            self._paramLandscapeProducts = arcpy.Parameter(
                    displayName="Landscape layers",
                    name="landscapeLayers",
                    datatype="GPValueTable",
                    parameterType="Required",
                    enabled=True,
                    direction="Input"
            )
            self._paramLandscapeProducts.columns = [['GPString', 'Layer'], ['GPString', 'Buffer distance']]
            self._paramLandscapeProducts.values = [['NWI Wetlands 2015', '50 feet'],['NHDPlus V.2 Flowlines', '50 feet'],
                                                   ["NHDPlus V.2  Waterbodies", '50 feet'], ["Roads","100 feet"],
                                                   ["Ventyx transmission", "100 feet"],["Ventyx natural gas line","30 ft"]]
        return self._paramLandscapeProducts

 

This one is using a Value Table parameter, but the problem is that I don't want the user to be able to add more entries to the table. Thus, I would like to remove or disable the combobox part of the Landscape layers parameter. Ideally, I also would like to have a checkbox in front of each landscape layer entry to be able to include or remove that layer from the analysis. This looks more like the thing I want but I'm not able to add another column with the buffer distances, that have to be editable.

 

 

    @property
    def paramElevationProducts(self):
        if not self._paramElevationProducts:
            self._paramElevationProducts = arcpy.Parameter(
                    displayName="Elevation Products",
                    name="outputElevationProducts",
                    datatype="GPString",
                    parameterType="Optional",
                    enabled=True,
                    direction="Input",
                    multiValue=True
            )
            self._paramElevationProducts.filter.type = "ValueList"
            self._paramElevationProducts.filter.list = [
                    "Aspect",
                    "Aspect_Map",
                    "Grayscale_Hillshade",
                    "Multi-Directional_Hillshade",
                    "Ellipsoidal_Height",
                    "Slope_Degrees",
                    "Slope_Degrees_Map",
                    "Elevation_Tinted_Hillshade"
            ]

        return self._paramElevationProducts

 

 

Thank you!

Outcomes