<?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: How to add file types to a multiple data type arcpy parameter in a Python toolbox? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1130009#M63385</link>
    <description>&lt;P&gt;I am just wondering how Esri did it for the KML to layer tool though...&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 08:16:41 GMT</pubDate>
    <dc:creator>calin_gi</dc:creator>
    <dc:date>2022-01-03T08:16:41Z</dc:date>
    <item>
      <title>How to add file types to a multiple data type arcpy parameter in a Python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1128245#M63309</link>
      <description>&lt;P&gt;In my custom Python toolbox,&amp;nbsp;I would like to create a similar input parameter as the "Input KML File" in the "KML To Layer" tool, i.e. allowing a layer to be selected by dropdown and by opening it from a file dialog (see screenshot below).&lt;/P&gt;&lt;P&gt;I can &lt;STRONG&gt;almost&amp;nbsp;&lt;/STRONG&gt;make this work by using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;param0 = arcpy.Parameter(
            displayName="Input KML/KMZ File",
            name="input_kml",
            datatype=["GPKMLLayer","DEFile"],
            parameterType="Required",
            direction="Input",
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that I now get the choose any file type instead of just kml and kmz files.&lt;/P&gt;&lt;P&gt;If I add the following code, I get an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;param0.filter.list = ["kml", "kmz"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make this work?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calin_gi_0-1640156149023.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30204iD1A33326A2103ABC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="calin_gi_0-1640156149023.png" alt="calin_gi_0-1640156149023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 06:56:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1128245#M63309</guid>
      <dc:creator>calin_gi</dc:creator>
      <dc:date>2021-12-22T06:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add file types to a multiple data type arcpy parameter in a Python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1128435#M63319</link>
      <description>&lt;P&gt;maybe multivalue= True,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;aram0 = arcpy.Parameter(
            displayName="Input KML/KMZ File",
            name="input_kml",
            datatype=["GPKMLLayer","DEFile"],
            parameterType="Required",
            multivalue= True,
            direction="Input",
        )
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 20:03:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1128435#M63319</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-22T20:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add file types to a multiple data type arcpy parameter in a Python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1128478#M63323</link>
      <description>&lt;P&gt;If you just use&amp;nbsp;datatype="GPKMLLayer", the tool will accept a KML layer in the map from the dropdown, or a .kml/kmz file from the &lt;SPAN&gt;file dialog&lt;/SPAN&gt;.&amp;nbsp; You'll be able to select a non .kml/kmz file in the&amp;nbsp;&lt;SPAN&gt;file dialog, but the tool will show a validation error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;param0 = arcpy.Parameter(
            displayName="Input KML/KMZ File",
            name="input_kml",
            datatype="GPKMLLayer",
            parameterType="Required",
            direction="Input",
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="unnamed.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30269iD654D759BE161185/image-size/medium?v=v2&amp;amp;px=400" role="button" title="unnamed.png" alt="unnamed.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 21:37:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1128478#M63323</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-22T21:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to add file types to a multiple data type arcpy parameter in a Python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1130009#M63385</link>
      <description>&lt;P&gt;I am just wondering how Esri did it for the KML to layer tool though...&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 08:16:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1130009#M63385</guid>
      <dc:creator>calin_gi</dc:creator>
      <dc:date>2022-01-03T08:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add file types to a multiple data type arcpy parameter in a Python toolbox?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1130155#M63393</link>
      <description>&lt;P&gt;I'm not sure it's possible with a Python Toolbox, perhaps a bug report or an ArcGIS Pro Ideas feature request about supporting filters for composite datatypes (e.g. parameter.filters[n].list = ["kml", "kmz"]) like is possible for value table parameters.&amp;nbsp; In a PYT, a parameter with a composite datatype does have a .filters property, but all the elements (one for each datatype) are None, not a filter object).&lt;/P&gt;&lt;P&gt;It is possible using a script tool instead of a python toolbox though...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Luke_Pinner_0-1641243985958.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/30650i18352FE5C71EC683/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Luke_Pinner_0-1641243985958.png" alt="Luke_Pinner_0-1641243985958.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 21:06:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-file-types-to-a-multiple-data-type/m-p/1130155#M63393</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-01-03T21:06:37Z</dc:date>
    </item>
  </channel>
</rss>

