<?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: Tool validator - required field starts as error in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96352#M3323</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks!&amp;nbsp; I saw that "altered" property in the help but didn't implement it properly.&amp;nbsp; Much nicer when my tool doesn't immediately throw a large red-X error at the user...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Jan 2011 19:22:39 GMT</pubDate>
    <dc:creator>SteveSalas</dc:creator>
    <dc:date>2011-01-20T19:22:39Z</dc:date>
    <item>
      <title>Tool validator - required field starts as error</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96350#M3321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am building a tool where the two required inputs are, in order, a geodatabase, and a domain name.&amp;nbsp; When I attempt a validator to create the list of domain names after the geodatabase is selected, the tool always opens with the geodatabase as an error (because it is a required parameter and not yet populated).&amp;nbsp; Is it possible to have it just show the green dot as a required input when the tool is first opened, rather than the red-X error?&amp;nbsp; I was under the impression the the updateParameters block was only executed after the interface is interacted with by the user.&amp;nbsp; Instead it seems to run this code as the tool is opened:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; def updateParameters(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Modify the values and properties of parameters before internal
&amp;nbsp;&amp;nbsp;&amp;nbsp; validation is performed.&amp;nbsp; This method is called whenever a parameter
&amp;nbsp;&amp;nbsp;&amp;nbsp; has been changed."""
&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(self.params[0].value)
&amp;nbsp;&amp;nbsp;&amp;nbsp; domList = desc.Domains
&amp;nbsp;&amp;nbsp;&amp;nbsp; domList.sort()
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[1].filter.list = domList
&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I click on the red-X, it shows:&amp;nbsp; ERROR updateParameters Execution Error: Runtime error : # does not exist&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any assistance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jan 2011 17:15:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96350#M3321</guid>
      <dc:creator>SteveSalas</dc:creator>
      <dc:date>2011-01-20T17:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Tool validator - required field starts as error</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96351#M3322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think updateParameters also runs when the tool is opened. Try conditionally executing your current code only if the first parameter has been altered:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def updateParameters(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Modify the values and properties of parameters before internal
&amp;nbsp;&amp;nbsp;&amp;nbsp; validation is performed.&amp;nbsp; This method is called whenever a parameter
&amp;nbsp;&amp;nbsp;&amp;nbsp; has been changed."""
&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.params[0].altered:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(self.params[0].value)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; domList = desc.Domains
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; domList.sort()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[1].filter.list = domList
&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:04:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96351#M3322</guid>
      <dc:creator>LoganPugh</dc:creator>
      <dc:date>2021-12-11T06:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Tool validator - required field starts as error</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96352#M3323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks!&amp;nbsp; I saw that "altered" property in the help but didn't implement it properly.&amp;nbsp; Much nicer when my tool doesn't immediately throw a large red-X error at the user...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jan 2011 19:22:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96352#M3323</guid>
      <dc:creator>SteveSalas</dc:creator>
      <dc:date>2011-01-20T19:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Tool validator - required field starts as error</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96353#M3324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, what's going on is your parameter doesn't yet have a value.&amp;nbsp; Test that your parameter has a value before describing it.&amp;nbsp; You can use the altered state as a test as suggested, but the truest test is that it has a value:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;if self.parameters[0].value:&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Feb 2011 03:16:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96353#M3324</guid>
      <dc:creator>DaleHoneycutt</dc:creator>
      <dc:date>2011-02-19T03:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Tool validator - required field starts as error</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96354#M3325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks to all of you.&amp;nbsp; I had this exact same problem, and the solutions listed here worked perfectly for me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 14:19:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-required-field-starts-as-error/m-p/96354#M3325</guid>
      <dc:creator>MelindaMorang1</dc:creator>
      <dc:date>2011-12-19T14:19:53Z</dc:date>
    </item>
  </channel>
</rss>

