<?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: IF STATEMENT Calculate Field Help ArcPro in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-calculate-field-help-arcpro/m-p/1116396#M42954</link>
    <description>&lt;P&gt;The code won't work as expected. The If statement will be satisfied with the first condition that evaluated to true, so inValue = 5000 would return 50. You want the logic to be like this instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def Reclass(inValue):
  if inValue is &amp;lt;= 1000:
    return 25
  elif inValue &amp;lt; 2000:
    return 50
  elif inValue &amp;lt; 5000:
    return 100
  else:
    return 150&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 16:55:55 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2021-11-12T16:55:55Z</dc:date>
    <item>
      <title>IF STATEMENT Calculate Field Help ArcPro</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-calculate-field-help-arcpro/m-p/1116364#M42942</link>
      <description>&lt;P&gt;Hello everyone. I am new to coding and need some help using the calculate field option.&lt;/P&gt;&lt;P&gt;I have one field (!ARA!) and another field (!Class!). When area is a certain size, I would like to change the attribution of !Class! to be either 25, 50, 100, or 200.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should the field name be !Class!?&lt;/P&gt;&lt;P&gt;Expression type : Python 3&lt;/P&gt;&lt;P&gt;What should the expression be?&lt;/P&gt;&lt;P&gt;Is this the correct code block?&lt;/P&gt;&lt;P&gt;def Reclass(!ARA!):&lt;BR /&gt;if !ARA! is &amp;lt;= 1000:&lt;BR /&gt;return 25&lt;BR /&gt;elif !ARA! &amp;gt;= 1000:&lt;BR /&gt;return 50&lt;BR /&gt;elif !ARA! &amp;gt;= 2000:&lt;BR /&gt;return 100&lt;BR /&gt;elif !ARA! &amp;gt;= 5000:&lt;BR /&gt;return 150&lt;/P&gt;&lt;P&gt;I keep getting syntax errors. I will appreciate any help! Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 16:13:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-calculate-field-help-arcpro/m-p/1116364#M42942</guid>
      <dc:creator>ABM2021</dc:creator>
      <dc:date>2021-11-12T16:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT Calculate Field Help ArcPro</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-calculate-field-help-arcpro/m-p/1116385#M42952</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def Reclass(!ARA!):
     if !ARA! is &amp;lt;= 1000:
         return 25
     elif !ARA! &amp;gt;= 1000:
        return 50
     elif !ARA! &amp;gt;= 2000:
        return 100
     elif !ARA! &amp;gt;= 5000:
        return 150&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can't tell if you've properly indented your def() as well as your if/elif so here ^ is what it should look.&amp;nbsp; That said I think your error is passing !ARA!.&amp;nbsp; Instead of passing that directly, try this approach:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def Reclass(inValue):
    if inValue is &amp;lt;= 1000:
        return 25
    elif inValue &amp;gt;= 1000:
        return 50
    elif inValue &amp;gt;= 2000:
        return 100
    elif inValue &amp;gt;= 5000:
        return 150&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your field calculator, enter :&lt;/P&gt;&lt;P&gt;reclass(!ARA!)&lt;/P&gt;&lt;P&gt;in the upper window.&lt;/P&gt;&lt;P&gt;Is !ARA! numeric?&amp;nbsp; If not that will be an issue as well.&lt;/P&gt;&lt;P&gt;Your logic is a little bit flawed as well: if !ARA! == 1,000 what &amp;nbsp;&lt;EM&gt;value&lt;/EM&gt; do you really want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 18:50:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-calculate-field-help-arcpro/m-p/1116385#M42952</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-11-12T18:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: IF STATEMENT Calculate Field Help ArcPro</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-calculate-field-help-arcpro/m-p/1116396#M42954</link>
      <description>&lt;P&gt;The code won't work as expected. The If statement will be satisfied with the first condition that evaluated to true, so inValue = 5000 would return 50. You want the logic to be like this instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def Reclass(inValue):
  if inValue is &amp;lt;= 1000:
    return 25
  elif inValue &amp;lt; 2000:
    return 50
  elif inValue &amp;lt; 5000:
    return 100
  else:
    return 150&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 16:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-calculate-field-help-arcpro/m-p/1116396#M42954</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-11-12T16:55:55Z</dc:date>
    </item>
  </channel>
</rss>

