<?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: Change Drop Down Menu for Parameter In Geoprocessing Pane in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/change-drop-down-menu-for-parameter-in/m-p/1406529#M81540</link>
    <description>&lt;P&gt;Thank you so much! This has been a great help, it's difficult to find resources on validation programming here.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Apr 2024 17:47:34 GMT</pubDate>
    <dc:creator>AnjeliDubey</dc:creator>
    <dc:date>2024-04-05T17:47:34Z</dc:date>
    <item>
      <title>Change Drop Down Menu for Parameter In Geoprocessing Pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-drop-down-menu-for-parameter-in/m-p/1405374#M81386</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am currently trying to change the drop down menu for one of the script tools I created. Currently, when I set a parameter to a feature class and I open the tool, the drop down menu for the parameter will show all the feature classes listen in the Contents Pane. I would like to change this so the drop down menu shows all feature classes within a specific geodatabase folder. How would I go about doing this? Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 18:26:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-drop-down-menu-for-parameter-in/m-p/1405374#M81386</guid>
      <dc:creator>AnjeliDubey</dc:creator>
      <dc:date>2024-04-03T18:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Change Drop Down Menu for Parameter In Geoprocessing Pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-drop-down-menu-for-parameter-in/m-p/1405941#M81474</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;So – yes- - it can be done but you will need to write some Python &lt;EM&gt;Validation&lt;/EM&gt; code within the &lt;STRONG&gt;ToolValidator&lt;/STRONG&gt; class of the &lt;STRONG&gt;Script Tool&lt;/STRONG&gt; properties dialog box and make some changes to your Python script tool dialog&lt;/P&gt;&lt;P&gt;1: Display the &lt;EM&gt;Tool Properties&lt;/EM&gt; dialog box for your script tool.&lt;/P&gt;&lt;P&gt;2: On your form create a new parameter which will allow you to search for a workspace, for example, use the following properties as a guide to search for a file geodatabase:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Label&lt;/EM&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Choose the Workspace&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Data Type&lt;/EM&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Workspace&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Filter&lt;/EM&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Workspace&lt;/STRONG&gt; :: &lt;EM&gt;Local File System&lt;/EM&gt; (This allows you to select ONLY file geodatabases)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think you may have a parameter which allows you to select feature layers from the &lt;EM&gt;Contents&lt;/EM&gt; pane?&lt;/P&gt;&lt;P&gt;3: Change this parameter using the following as a guide:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Label&lt;/EM&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Choose the Feature class&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Data Type&lt;/EM&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;String&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Filter&lt;/EM&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Value List&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (This means your parameter will display values within a drop down list)&lt;/P&gt;&lt;P&gt;Your parameters tab in the &lt;EM&gt;Tool Properties&lt;/EM&gt; dialog &amp;nbsp;box should look like the following:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdMorris_0-1712253236489.png" style="width: 637px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100096iCFCD3605E7E1EE1D/image-dimensions/637x107?v=v2" width="637" height="107" role="button" title="EdMorris_0-1712253236489.png" alt="EdMorris_0-1712253236489.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Notice the numbers next to the parameters: 0 is the position of the workspace parameter while 1 is the position of the feature class parameter. You will use these numbers in a moment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4: Click the &lt;STRONG&gt;Validation&lt;/STRONG&gt; tab.&lt;/P&gt;&lt;P&gt;This is where you can write Python code which will execute when your form is displayed or when you interact with the parameters on the form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5: Locate the &lt;STRONG&gt;updateParameters()&lt;/STRONG&gt; method.&lt;/P&gt;&lt;P&gt;6: Underneath the comment for the method write the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;wkParam = self.params[0]
if wkParam.altered and not wkParam.hasBeenValidated:
    fcParam = self.params[1]
    arcpy.env.workspace = wkParam.value
    fcs = arcpy.ListFeatureClasses()
    if len(fcs) &amp;gt; 0:
        fcParam.filter.list = fcs
        fcParam.value = fcs[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be aware of the importance of indentation!&lt;/P&gt;&lt;P&gt;What the code does is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Get the parameters from a list of parameters from the dialog.&lt;/LI&gt;&lt;LI&gt;Check to see if the workspace parameter has been altered by the user choosing a workspace and that the parameter has not gone through ArcGIS Pro’s validation routines already. If you don’t put this check in then you will be forever in a validation spiral which will affect the performance of your script tool.&lt;/LI&gt;&lt;LI&gt;Get the chosen workspace and a list of feature classes&lt;/LI&gt;&lt;LI&gt;Assign the list of feature classes to the feature class parameter using the filter and list properties on the Parameter object. Remember we set the Filter to be a Value List earlier?&lt;/LI&gt;&lt;LI&gt;Get the 1st item from the list and assign it as the first item for display in the combo box before the user clicks on it.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The method should look like the following:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdMorris_1-1712253474021.png" style="width: 701px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100100i9094E3CE9A32A996/image-dimensions/701x268?v=v2" width="701" height="268" role="button" title="EdMorris_1-1712253474021.png" alt="EdMorris_1-1712253474021.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;7: Press the &lt;STRONG&gt;OK&lt;/STRONG&gt; button on the &lt;EM&gt;Tool Properties&lt;/EM&gt; dialog box.&lt;/P&gt;&lt;P&gt;8: Double click the script tool to display the dialog:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdMorris_2-1712253520100.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100101i429E007A581065B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdMorris_2-1712253520100.png" alt="EdMorris_2-1712253520100.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;9: Choose a file geodatabase&lt;/P&gt;&lt;P&gt;The &lt;EM&gt;Choose Feature&lt;/EM&gt; &lt;EM&gt;Class&lt;/EM&gt; parameter will now be populated with the feature classes within the chosen file geodatabase.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdMorris_3-1712253546216.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100102iB950B819F96F94D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdMorris_3-1712253546216.png" alt="EdMorris_3-1712253546216.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you choose a different file geodatabase then the drop down combo box will be cleared and re-populated with the new feature classes from the geodatabase!&lt;/P&gt;&lt;P&gt;I hope this does what you want it to do.&lt;/P&gt;&lt;P&gt;I will make this into a blog to add a bit of meat to these bones and i'll put the link here once it's written but this should be enough for you....&lt;/P&gt;&lt;P&gt;Many thanks ed&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 18:04:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-drop-down-menu-for-parameter-in/m-p/1405941#M81474</guid>
      <dc:creator>EdMorris</dc:creator>
      <dc:date>2024-04-04T18:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change Drop Down Menu for Parameter In Geoprocessing Pane</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/change-drop-down-menu-for-parameter-in/m-p/1406529#M81540</link>
      <description>&lt;P&gt;Thank you so much! This has been a great help, it's difficult to find resources on validation programming here.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 17:47:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/change-drop-down-menu-for-parameter-in/m-p/1406529#M81540</guid>
      <dc:creator>AnjeliDubey</dc:creator>
      <dc:date>2024-04-05T17:47:34Z</dc:date>
    </item>
  </channel>
</rss>

