<?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 script not working in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661359#M22016</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ugh.&amp;nbsp; Not what I wanted to hear!&amp;nbsp; But thank you for testing it and for your reply!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Amy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Feb 2012 13:47:55 GMT</pubDate>
    <dc:creator>AmyMeehan</dc:creator>
    <dc:date>2012-02-07T13:47:55Z</dc:date>
    <item>
      <title>Tool Validator script not working</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661357#M22014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to write a script in the Tool Validator so that the user can choose one of three options in the first parameter, and based on the user's choice, the other 3 parameters are either enabled or disabled.&amp;nbsp; However, I cannot seem to get it to work properly.&amp;nbsp; Nothing happens in the tool when I change the first parameter.&amp;nbsp; My other 3 parameters are feature sets.&amp;nbsp; The "Add Records Interactively" part is greyed out while the "Use records from" is enabled in all of them.&amp;nbsp; My script is below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;class ToolValidator:
&amp;nbsp; """Class for validating a tool's parameter values and controlling
&amp;nbsp; the behavior of the tool's dialog."""

&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Setup arcpy and the list of tool parameters."""
&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params = arcpy.GetParameterInfo()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print self.params

&amp;nbsp; def initializeParameters(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[1].category = "Feature Types"
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[2].category = "Feature Types"
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[3].category = "Feature Types"
&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; """Refine the properties of a tool's parameters.&amp;nbsp; This method is
&amp;nbsp;&amp;nbsp;&amp;nbsp; called when the tool is opened."""
&amp;nbsp;&amp;nbsp;&amp;nbsp; return

&amp;nbsp; def updateParameters(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.params[0].altered:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if self.params[0].value == "Point":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[1].enabled = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[2].enabled = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[3].enabled = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif self.params[0].value == "Line":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[1].enabled = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[2].enabled = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[3].enabled = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif self.params[0].value == "Polygon":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[1].enabled = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[2].enabled = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.params[3].enabled = 1

&amp;nbsp;&amp;nbsp;&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 parmater
&amp;nbsp;&amp;nbsp;&amp;nbsp; has been changed."""
&amp;nbsp;&amp;nbsp;&amp;nbsp; return

&amp;nbsp; def updateMessages(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Modify the messages created by internal validation for each tool
&amp;nbsp;&amp;nbsp;&amp;nbsp; parameter.&amp;nbsp; This method is called after internal validation."""
&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;What am I doing wrong?&amp;nbsp; I'm completely stumped!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for any help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Amy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 16:52:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661357#M22014</guid>
      <dc:creator>AmyMeehan</dc:creator>
      <dc:date>2012-02-06T16:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Validator script not working</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661358#M22015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What am I doing wrong?&amp;nbsp; I'm completely stumped!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried your script and got the same results, though for another, similar type (Feature Layer) your logic worked perfectly. My guess is this is not supported for feature set parameters because of their special ability to interact with the hosting application.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 20:37:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661358#M22015</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-02-06T20:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Validator script not working</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661359#M22016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ugh.&amp;nbsp; Not what I wanted to hear!&amp;nbsp; But thank you for testing it and for your reply!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Amy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 13:47:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661359#M22016</guid>
      <dc:creator>AmyMeehan</dc:creator>
      <dc:date>2012-02-07T13:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Validator script not working</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661360#M22017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have been doing some research on the same topic, about categorising the parameters on the script tool dialog, and came across your message. I have tried your code in v.10 and it worked just fine. I think the problem was defining the right data datatype for your parameters. Here is the details:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- In the source .py file there are 4 params set by arcpy.GetParameterByText(x);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- In the script properties' Parameters tab, all parameters are set to String (This makes the difference I reckon);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Only the first parameter has a Value List filter which contains the values of Point|Polygon|Line (w/o quotation);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run it, the script enables the right box among three given. If you are planning to use feature class as the first parameter instead of a string, you need to use Describe tool to access feature class properties in string format.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My problem was whether it is possible to set param&lt;X&gt;.category property outside the getParameterInfo() def and the answer is that it is possible in initializeParameters(self).&lt;/X&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Fatih&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2013 00:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/tool-validator-script-not-working/m-p/661360#M22017</guid>
      <dc:creator>FatihDur</dc:creator>
      <dc:date>2013-02-07T00:00:11Z</dc:date>
    </item>
  </channel>
</rss>

