<?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 script with the IF statements in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-with-the-if-statements/m-p/80300#M6460</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a researcher ISPRA (Institute of the Ministry of Environment has several hundred licenses for ArcGIS) and I need urgent help to create a procedure in VBA or Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is as follows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a shape file with the following numeric fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A = decimal number ranging from - 10 to + 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;B = decimal number ranging from - 10 to + 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C = decimal number ranging from - 10 to + 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;D = average of A, B and C&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Category = (initially all 0, and be filled with the result of the script).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need a procedure based on the specific values ??????of the fields A, B, C and D for that record or object attribute to the Category field value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The conditions for the same record or object are as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- If both values ??????of A, B and C are &amp;lt;0 then assign at the Category field the value 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- In case at least one of the values ??????of A, B and C is&amp;gt; 0 and the value of D is &amp;lt;0, then it will assign at the Category field the value 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- If both the value of D is&amp;gt; 0, then it will assign at the Category field the value 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How I could implement this procedure? With a script in VBA or Python?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this regard, the script should be written in the Field Calculator of the field "Category" ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to write the following script in Field Calculator but it get error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if! M_IND! &amp;lt;0 and! PAH_IND! &amp;lt;0 and! HOC_IND! &amp;lt;0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elif! M_IND! &amp;lt;0 or! PAH_IND! &amp;lt;0 or! HOC_IND! &amp;lt;0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Give me a hand?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you and Merry Christmas.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Dec 2012 15:37:20 GMT</pubDate>
    <dc:creator>PasqualeLanera1</dc:creator>
    <dc:date>2012-12-19T15:37:20Z</dc:date>
    <item>
      <title>script with the IF statements</title>
      <link>https://community.esri.com/t5/python-questions/script-with-the-if-statements/m-p/80300#M6460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a researcher ISPRA (Institute of the Ministry of Environment has several hundred licenses for ArcGIS) and I need urgent help to create a procedure in VBA or Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is as follows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a shape file with the following numeric fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A = decimal number ranging from - 10 to + 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;B = decimal number ranging from - 10 to + 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;C = decimal number ranging from - 10 to + 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;D = average of A, B and C&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Category = (initially all 0, and be filled with the result of the script).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need a procedure based on the specific values ??????of the fields A, B, C and D for that record or object attribute to the Category field value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The conditions for the same record or object are as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- If both values ??????of A, B and C are &amp;lt;0 then assign at the Category field the value 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- In case at least one of the values ??????of A, B and C is&amp;gt; 0 and the value of D is &amp;lt;0, then it will assign at the Category field the value 2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- If both the value of D is&amp;gt; 0, then it will assign at the Category field the value 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How I could implement this procedure? With a script in VBA or Python?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this regard, the script should be written in the Field Calculator of the field "Category" ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to write the following script in Field Calculator but it get error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if! M_IND! &amp;lt;0 and! PAH_IND! &amp;lt;0 and! HOC_IND! &amp;lt;0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elif! M_IND! &amp;lt;0 or! PAH_IND! &amp;lt;0 or! HOC_IND! &amp;lt;0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Give me a hand?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you and Merry Christmas.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2012 15:37:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-with-the-if-statements/m-p/80300#M6460</guid>
      <dc:creator>PasqualeLanera1</dc:creator>
      <dc:date>2012-12-19T15:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: script with the IF statements</title>
      <link>https://community.esri.com/t5/python-questions/script-with-the-if-statements/m-p/80301#M6461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;try doing this, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;def getValue(M_IND, PAH_IND, HOC_IND):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if M_IND &amp;lt;0 and PAH_IND &amp;lt;0 and HOC_IND &amp;lt;0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; elif M_IND &amp;lt;0 or PAH_IND &amp;lt;0 or HOC_IND &amp;lt;0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;---------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;getValue(!M_IND!, !PAH_IND!, !HOC_IND!)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2012 12:36:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-with-the-if-statements/m-p/80301#M6461</guid>
      <dc:creator>CarlSunderman</dc:creator>
      <dc:date>2012-12-20T12:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: script with the IF statements</title>
      <link>https://community.esri.com/t5/python-questions/script-with-the-if-statements/m-p/80302#M6462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Happy Christmas&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2012 13:48:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-with-the-if-statements/m-p/80302#M6462</guid>
      <dc:creator>PasqualeLanera1</dc:creator>
      <dc:date>2012-12-20T13:48:34Z</dc:date>
    </item>
  </channel>
</rss>

