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!
Did you ever find a solution for this?
Thanks,
Randal
I figured out the first part of your question! You can specify .values for a ValueTable parameter without specifying .list, as per the following example from a Python toolbox tool (note, no .list is provided for filters[0]):
metrics = arcpy.Parameter(
displayName = 'Metrics', name = 'metrics',
datatype = 'GPValueTable',
parameterType = 'Required',
direction = 'Input')
metrics.columns = [['GPString', 'Metric'], ['GPLong', 'Relative Weight']]
metrics.filters[1].list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
metrics.values = [['Metric A', 0], ['Metric B', 0]]
For the second part of your question, try a column of type Boolean.
Randal
Thank you Randal! We ended up using the combobox to be able to add local data to the list. So, we kept it like that, but it is good to know the answer.