I am trying to create a Python Toolbox in ArcGIS 10.1 and can't seem to replicate something like what I see in the Summary Statistics tool where the user builds a Value Table that contains a list of Fields and then within the table the user must pick from a list of valid Statistic types (SUM, MEAN, etc). Anyone have an idea or experience doing this? Thanks.
Unfortunately, adding a drop-down of keywords is not supported at the moment in a Python toolbox value table parameter. The way it's implemented right now, the closest that can be done would be to validate the column in updateMessages and add messages to the parameter indicating the choices. Admittedly that's far from ideal. If you want to create an exact match of the Summary Statistic tool's value table parameter that is a little easier. You could mine the parameter from the tool using the arcpy.GetParameterInfo function and use that in python toolbox tool's getParameterInfo. Something like this below:
def getParameterInfo(self):
in_table = arcpy.Parameter(
name="in_table",
displayName="Input Table",
datatype="Table View",
direction="Input",
parameterType="Required")
stats_field = arcpy.GetParameterInfo("Statistics_analysis")[2]
stats_field.parameterDependencies = [in_table.name]
return [in_table, stats_field]
-Dave