<?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 Enabling tool parameters based on user input - ArcGIS Pro model builder in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/enabling-tool-parameters-based-on-user-input/m-p/1040835#M25358</link>
    <description>&lt;P&gt;I have created a custom geoprocessing tool using python and set up the tool with a boolean parameter (param 3) that when selected enables one parameter (param 6) and disables two others&amp;nbsp; (params 4, 5) and when not selected does the opposite. I set it up using the below code in the validation section of tool properties. This works well when I just run the tool, but when I add it into model builder all parameters are always enabled. Is there a way to have it behave the same way in model builder as it does as a stand alone tool?&lt;/P&gt;&lt;P&gt;Note: I also included functionality so param 5's value list updates based on param 4' value and this works in model builder and as a standalone tool.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def updateParameters(self):
        self.params[3].enabled = True
        self.params[4].enabled = True
        self.params[5].enabled = False
        self.params[6].enabled = False
        if self.params[3].value == True:
            self.params[4].enabled = False
            self.params[6].enabled = True
        else:
            # Modify parameter values and properties.
            # This gets called each time a parameter is modified, before 
            # standard validation.
            if self.params[4].value == "Food":
                self.params[5].enabled = True
                self.params[5].filter.list = ["live animals", "cereal grains"]
            elif self.params[4].value == "Energy":
                self.params[5].enabled = True
                self.params[5].filter.list = ["base/minimum", "peak/maximum"]
            elif self.params[4].value == "Water":
                self.params[5].enabled = True
                self.params[5].filter.list = ["surface water", "ground water"]
            elif self.params[4].value == "Industrial":
                self.params[5].enabled = True
                self.params[5].filter.list = ["stone", "natural sands"]
            elif self.params[4].value == "Waste":
                self.params[5].enabled = True
                self.params[5].filter.list = ["MSW", "All"]
            elif self.params[4].value == "Services":
                self.params[5].enabled = True
                self.params[5].filter.list = ["Private", "non-transportation"]
        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Mar 2021 21:20:42 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-03-25T21:20:42Z</dc:date>
    <item>
      <title>Enabling tool parameters based on user input - ArcGIS Pro model builder</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/enabling-tool-parameters-based-on-user-input/m-p/1040835#M25358</link>
      <description>&lt;P&gt;I have created a custom geoprocessing tool using python and set up the tool with a boolean parameter (param 3) that when selected enables one parameter (param 6) and disables two others&amp;nbsp; (params 4, 5) and when not selected does the opposite. I set it up using the below code in the validation section of tool properties. This works well when I just run the tool, but when I add it into model builder all parameters are always enabled. Is there a way to have it behave the same way in model builder as it does as a stand alone tool?&lt;/P&gt;&lt;P&gt;Note: I also included functionality so param 5's value list updates based on param 4' value and this works in model builder and as a standalone tool.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def updateParameters(self):
        self.params[3].enabled = True
        self.params[4].enabled = True
        self.params[5].enabled = False
        self.params[6].enabled = False
        if self.params[3].value == True:
            self.params[4].enabled = False
            self.params[6].enabled = True
        else:
            # Modify parameter values and properties.
            # This gets called each time a parameter is modified, before 
            # standard validation.
            if self.params[4].value == "Food":
                self.params[5].enabled = True
                self.params[5].filter.list = ["live animals", "cereal grains"]
            elif self.params[4].value == "Energy":
                self.params[5].enabled = True
                self.params[5].filter.list = ["base/minimum", "peak/maximum"]
            elif self.params[4].value == "Water":
                self.params[5].enabled = True
                self.params[5].filter.list = ["surface water", "ground water"]
            elif self.params[4].value == "Industrial":
                self.params[5].enabled = True
                self.params[5].filter.list = ["stone", "natural sands"]
            elif self.params[4].value == "Waste":
                self.params[5].enabled = True
                self.params[5].filter.list = ["MSW", "All"]
            elif self.params[4].value == "Services":
                self.params[5].enabled = True
                self.params[5].filter.list = ["Private", "non-transportation"]
        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 21:20:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/enabling-tool-parameters-based-on-user-input/m-p/1040835#M25358</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-25T21:20:42Z</dc:date>
    </item>
  </channel>
</rss>

