<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Toolbox: Value Tables parameters: accept composite data types? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-toolbox-value-tables-parameters-accept/m-p/1538256#M72829</link>
    <description>&lt;P&gt;I would do the type checking in the validation function instead of the initialization. You can just pass "GPType" as the datatype and let it take any input then immediately set an error message on the parameter if the datatype is invalid. Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

param2 = arcpy.Parameter(
    displayName='Input Data',
    name='InputData',
    datatype="GPValueTable",
    parameterType='Required',
    direction='Input')

dTypes = [
    "DEFeatureClass", 
    "DEFeatureDataset", 
    "DETable",
    "DEMosaicDataset",
    "DERasterDataset",
]

# Use generic type by 
param2.columns = [["GPType", "Old"], ["GPType", "New"]]

# This goes wherever your validation function is
def validate_gp_table_types(param: arcpy.Parameter, allowed_types: list):
    for row in param.value:
        if arcpy.Describe(row[0]).dataType not in allowed_types:
            param.setErrorMessage(f"{row[0]} is not a valid data type {allowed_types} required")
    return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also try filtering after you create the column, this is untested though so just take it as more of an idea.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

param2 = arcpy.Parameter(
    displayName='Input Data',
    name='InputData',
    datatype="GPValueTable",
    parameterType='Required',
    direction='Input')

dTypes = \
    [
        "DEFeatureClass", 
        "DEFeatureDataset", 
        "DETable",
        "DEMosaicDataset",
        "DERasterDataset",
    ]

param2.columns = \
    [
        ["GPType", "Old"], 
        ["GPType", "New"]
    ]

for filter in param2.filters:
    filter.type = "ValueList"
    filter.list = dTypes

params = [param2]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Sep 2024 13:17:07 GMT</pubDate>
    <dc:creator>HaydenWelch</dc:creator>
    <dc:date>2024-09-13T13:17:07Z</dc:date>
    <item>
      <title>Python Toolbox: Value Tables parameters: accept composite data types?</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-value-tables-parameters-accept/m-p/1537962#M72821</link>
      <description>&lt;P&gt;I'm trying to set up a value table to accept multiple parameter data types as input. It's possible for non-value table parameters; from the&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/defining-parameter-data-types-in-a-python-toolbox.htm" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;&amp;nbsp;:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def getParameterInfo(self):
    #Define parameter definitions

    # First parameter
    param0 = arcpy.Parameter(
        displayName="Input Raster Dataset",
        name="in_rasterdataset",
        datatype=["DERasterDataset", "DERasterCatalog"],
        parameterType="Required",
        direction="Input")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try on value tables, I get the following error.&lt;/P&gt;&lt;LI-CODE lang="python"&gt; param2 = arcpy.Parameter(displayName='Input Data',
                                 name='InputData',
                                 datatype="GPValueTable",
                                 parameterType='Required',
                                 direction='Input')
        dTypes = ["DEFeatureClass", "DEFeatureDataset", "DETable",
                  "DEMosaicDataset", "DERasterDataset"]
        param2.columns = [[dTypes, "Old"], [dTypes, "New"]]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_0-1726170442814.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/114936i633D7465408CA2AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_0-1726170442814.png" alt="AlfredBaldenweck_0-1726170442814.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hmm, ok. Maybe I'm just doing it wrong? Let me try making it a single parameter type&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        param2 = arcpy.Parameter(displayName='Input Data',
                                 name='InputData',
                                 datatype="GPValueTable",
                                 parameterType='Required',
                                 direction='Input')
        param2.columns = [["DEFeatureClass", "Old"], ["DEFeatureClass", "New"]]&lt;/LI-CODE&gt;&lt;P&gt;Bingo:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlfredBaldenweck_1-1726170500073.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/114937iD6CF2A9AD7E4CA13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlfredBaldenweck_1-1726170500073.png" alt="AlfredBaldenweck_1-1726170500073.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So, my question is:&amp;nbsp;&lt;STRONG&gt;How can I make a value table parameter accept multiple data types?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(Also, before anyone suggests it, I did already try&lt;/P&gt;&lt;LI-CODE lang="python"&gt;param2.columns = [[["DEFeatureClass", "DETable"], "Old"], 
                   ["DEFeatureClass", "DETable"], "New"]
                 ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;with the same results.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 19:51:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-value-tables-parameters-accept/m-p/1537962#M72821</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2024-09-12T19:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox: Value Tables parameters: accept composite data types?</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-value-tables-parameters-accept/m-p/1538256#M72829</link>
      <description>&lt;P&gt;I would do the type checking in the validation function instead of the initialization. You can just pass "GPType" as the datatype and let it take any input then immediately set an error message on the parameter if the datatype is invalid. Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

param2 = arcpy.Parameter(
    displayName='Input Data',
    name='InputData',
    datatype="GPValueTable",
    parameterType='Required',
    direction='Input')

dTypes = [
    "DEFeatureClass", 
    "DEFeatureDataset", 
    "DETable",
    "DEMosaicDataset",
    "DERasterDataset",
]

# Use generic type by 
param2.columns = [["GPType", "Old"], ["GPType", "New"]]

# This goes wherever your validation function is
def validate_gp_table_types(param: arcpy.Parameter, allowed_types: list):
    for row in param.value:
        if arcpy.Describe(row[0]).dataType not in allowed_types:
            param.setErrorMessage(f"{row[0]} is not a valid data type {allowed_types} required")
    return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also try filtering after you create the column, this is untested though so just take it as more of an idea.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

param2 = arcpy.Parameter(
    displayName='Input Data',
    name='InputData',
    datatype="GPValueTable",
    parameterType='Required',
    direction='Input')

dTypes = \
    [
        "DEFeatureClass", 
        "DEFeatureDataset", 
        "DETable",
        "DEMosaicDataset",
        "DERasterDataset",
    ]

param2.columns = \
    [
        ["GPType", "Old"], 
        ["GPType", "New"]
    ]

for filter in param2.filters:
    filter.type = "ValueList"
    filter.list = dTypes

params = [param2]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2024 13:17:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-value-tables-parameters-accept/m-p/1538256#M72829</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2024-09-13T13:17:07Z</dc:date>
    </item>
  </channel>
</rss>

