<?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: Check for checkbox status in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/check-for-checkbox-status/m-p/714129#M55384</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the link. I am using 'altered' for some string fields earlier in the tool to actually 'enable' the checkbox in the first place. I guess I can make use of 'altered' property, defining an initial value and switch that value forth and back when the checkbox is turned on and off (altered).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am fine using parameters&lt;X&gt;.value. However, I do not know what the value actually is. &lt;/X&gt;&lt;/P&gt;&lt;P&gt;I know that valueAsText returns 'true' or 'None' but I cannot check explicitly against these values, and I find that strange.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Oct 2014 11:00:54 GMT</pubDate>
    <dc:creator>TomGeo</dc:creator>
    <dc:date>2014-10-12T11:00:54Z</dc:date>
    <item>
      <title>Check for checkbox status</title>
      <link>https://community.esri.com/t5/python-questions/check-for-checkbox-status/m-p/714127#M55382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Writing a tool within a Python toolbox I ran into the problem of checking the status of some checkbox.&lt;/P&gt;&lt;P&gt;While setting a default value for the checkbox is no problem,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14130364975432639 jive_text_macro" jivemacro_uid="_14130364975432639"&gt;
&lt;P&gt;parameter_bool.value = True&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it comes kind of strange to retrieve the status. If I am not completely wrong then every parameter has two possibilities to achieve that: value, and valueAsText.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I tried to check against the value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_141303673841190 jive_text_macro" jivemacro_uid="_141303673841190"&gt;
&lt;P&gt;if parameters[0].value is True:&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then against valueAsText,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14130368307012864" jivemacro_uid="_14130368307012864"&gt;
&lt;P&gt;if paramaters[0].valueAsText == 'true':&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It took me a bit to realize that valueAsText will return either &lt;SPAN style="font-family: courier new,courier; font-size: 10pt; color: #3334ca;"&gt;'true'&lt;/SPAN&gt; or &lt;SPAN style="color: #3334ca; font-family: courier new,courier;"&gt;'None'&lt;/SPAN&gt;. Why does it not return &lt;SPAN style="color: #3334ca;"&gt;'false'&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;However to check against it did not work. This part of the loop was never touched...&lt;/P&gt;&lt;P&gt;I ended up in using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14130372248153578" jivemacro_uid="_14130372248153578"&gt;
&lt;P&gt;if parameters[0].value:&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;or&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14130372409527154" jivemacro_uid="_14130372409527154"&gt;
&lt;P&gt;if not parameter[0].value:&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody explain to me why it is impossible to check against the textual value by using the same strings that will be returned if I retrieve them this way?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14130374419334691 jive_text_macro" jivemacro_uid="_14130374419334691"&gt;
&lt;P&gt;arcpy.AddMessage(str(parameters[0].valueAsText))&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wouldn't it be much easier to simply check the value against True/False?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Oct 2014 14:28:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-for-checkbox-status/m-p/714127#M55382</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2014-10-11T14:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Check for checkbox status</title>
      <link>https://community.esri.com/t5/python-questions/check-for-checkbox-status/m-p/714128#M55383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Customizing_tool_behavior_in_a_Python_toolbox/00150000002m000000/"&gt;In this link&lt;/A&gt; there is an enabled and altered property which returns a Boolean rather than the value property.&amp;nbsp; perhaps those may be more useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Oct 2014 14:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-for-checkbox-status/m-p/714128#M55383</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-10-11T14:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Check for checkbox status</title>
      <link>https://community.esri.com/t5/python-questions/check-for-checkbox-status/m-p/714129#M55384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the link. I am using 'altered' for some string fields earlier in the tool to actually 'enable' the checkbox in the first place. I guess I can make use of 'altered' property, defining an initial value and switch that value forth and back when the checkbox is turned on and off (altered).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am fine using parameters&lt;X&gt;.value. However, I do not know what the value actually is. &lt;/X&gt;&lt;/P&gt;&lt;P&gt;I know that valueAsText returns 'true' or 'None' but I cannot check explicitly against these values, and I find that strange.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2014 11:00:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-for-checkbox-status/m-p/714129#M55384</guid>
      <dc:creator>TomGeo</dc:creator>
      <dc:date>2014-10-12T11:00:54Z</dc:date>
    </item>
  </channel>
</rss>

