<?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: Disable &amp;quot;add another&amp;quot; in Python Toolbox in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1378627#M27149</link>
    <description>&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;This is a really interesting answer, a property of parameters I was unaware of. I'm developing a toolbox (the python code is embedding in the atbx) and was wondering if what you suggest can work for a specific scenario.&lt;/P&gt;&lt;P&gt;ESRI have have introduced that switch under parameters that take layers\tables&amp;nbsp; with a selection. If the layer has a selection then the switch appears in an on state.&lt;/P&gt;&lt;P&gt;Can your technique you show above&amp;nbsp; be used to hide the switch? It causes conflicts with the design of my tools and the code to fail if a user chooses to switch it off.&lt;/P&gt;&lt;P&gt;Duncan&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2024 14:38:25 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2024-02-06T14:38:25Z</dc:date>
    <item>
      <title>Disable "add another" in Python Toolbox</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1369727#M27122</link>
      <description>&lt;P&gt;I'm creating a python toolbox and can't figure out how I can prevent the "Add Another"&amp;nbsp; button from appearing.&amp;nbsp; Below is the interface of my tool and the code that shows the property of the second parameter, Arterial Weights.&amp;nbsp; I figured setting the `&lt;STRONG&gt;multiValue=False&lt;/STRONG&gt;` would do the trick, but it didn't work.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kim_hspartner_0-1705083341344.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/91466i3E13AF64FF8AC25D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kim_hspartner_0-1705083341344.png" alt="kim_hspartner_0-1705083341344.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    param = arcpy.Parameter(
        displayName='{0} Weights'.format(mode_name.capitalize()),
        name='{0}_weights'.format(mode_name),
        datatype='GPValueTable',
        parameterType='Required',
        direction='Input',
        multiValue=False
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 18:20:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1369727#M27122</guid>
      <dc:creator>kim_hspartner</dc:creator>
      <dc:date>2024-01-12T18:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Disable "add another" in Python Toolbox</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1376859#M27139</link>
      <description>&lt;P&gt;Hi Kim,&lt;/P&gt;&lt;P&gt;Yes, there's a way to do this. It's not that obvious.&lt;/P&gt;&lt;P&gt;For some parameters, there are extra control types that will support a different appearance and behaviors.&lt;/P&gt;&lt;P&gt;What you're seeing is the default control for a parameter with a Value Table data type. By default, someone can add multiple sets of values.&lt;/P&gt;&lt;P&gt;But, you can modify this default behavior by setting the parameter object's controlCLSID property.&lt;/P&gt;&lt;P&gt;So, for example, with my own code, if I create a Value Table parameter with the default control, you get this (similar to your example):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        param1 = arcpy.Parameter(
            displayName='Arterials Weights',
            name='arterials_weights',
            datatype='GPValueTable',
            parameterType='Required',
            direction='Input',
        )

        param1.columns = [['GPString', 'A'], ['GPString', 'B'], ['GPString', 'C'], ['GPString', 'D'], ['GPString', 'E']]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DavidWynne_0-1706752911499.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93393i633CFD1D95DB953F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DavidWynne_0-1706752911499.png" alt="DavidWynne_0-1706752911499.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use the same parameter information, but then also set the controlCLSID value to a string of&amp;nbsp;&lt;FONT face="courier new,courier"&gt;'{1A1CA7EC-A47A-4187-A15C-6EDBA4FE0CF7}',&amp;nbsp;&lt;/FONT&gt;I get the following appearance, limiting the Value Table to single set of values.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        param1 = arcpy.Parameter(
            displayName='Arterials Weights',
            name='arterials_weights',
            datatype='GPValueTable',
            parameterType='Required',
            direction='Input',
        )

        param1.columns = [['GPString', 'A'], ['GPString', 'B'], ['GPString', 'C'], ['GPString', 'D'], ['GPString', 'E']]
        param1.controlCLSID = '{1A1CA7EC-A47A-4187-A15C-6EDBA4FE0CF7}'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DavidWynne_1-1706753030891.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93394iBA619B4B6B6084BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DavidWynne_1-1706753030891.png" alt="DavidWynne_1-1706753030891.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's some other examples here:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/parameter-controls.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/geoprocessing_and_python/parameter-controls.htm&lt;/A&gt;. It's not a complete list, and it doesn't include this one (it should).&lt;/P&gt;&lt;P&gt;Does that help? Let me know if you have any questions.&lt;/P&gt;&lt;P&gt;-Dave&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2024 02:09:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1376859#M27139</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2024-02-01T02:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Disable "add another" in Python Toolbox</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1378627#M27149</link>
      <description>&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;This is a really interesting answer, a property of parameters I was unaware of. I'm developing a toolbox (the python code is embedding in the atbx) and was wondering if what you suggest can work for a specific scenario.&lt;/P&gt;&lt;P&gt;ESRI have have introduced that switch under parameters that take layers\tables&amp;nbsp; with a selection. If the layer has a selection then the switch appears in an on state.&lt;/P&gt;&lt;P&gt;Can your technique you show above&amp;nbsp; be used to hide the switch? It causes conflicts with the design of my tools and the code to fail if a user chooses to switch it off.&lt;/P&gt;&lt;P&gt;Duncan&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 14:38:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1378627#M27149</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2024-02-06T14:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Disable "add another" in Python Toolbox</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1378812#M27150</link>
      <description>&lt;P&gt;Hi Duncan,&amp;nbsp;&lt;BR /&gt;Unfortunately, no, there isn't a different parameter control that will disable the selection toggle. If the tool expects and requires a selection, you could do something like what the Eliminate tool does, which checks if the input has a selection upfront in the execution code.&lt;/P&gt;&lt;P&gt;In Python, you could use Describe's FIDSet property such as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;in_features = arcpy.GetParameterAsText(0)

desc = arcpy.Describe(in_features)
if not getattr(desc, 'FIDSet', ''):
    arcpy.AddError('Input must have a selection.')
    sys.exit()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I've used `getattr` to add some flexibility, since if the input is a feature class (not a layer), `FIDSet` isn't available from Describe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 19:23:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/disable-quot-add-another-quot-in-python-toolbox/m-p/1378812#M27150</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2024-02-06T19:23:34Z</dc:date>
    </item>
  </channel>
</rss>

