<?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: Field calculator in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152879#M3551</link>
    <description>&lt;P&gt;You didn't include the other fields you were comparing in the function definition.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1646994150351.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36133iEE43CB9BC0539E39/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1646994150351.png" alt="KimGarbade_0-1646994150351.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2022 10:23:29 GMT</pubDate>
    <dc:creator>KimberlyGarbade</dc:creator>
    <dc:date>2022-03-11T10:23:29Z</dc:date>
    <item>
      <title>Field calculator</title>
      <link>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152853#M3549</link>
      <description>&lt;P&gt;Hi community....&lt;/P&gt;&lt;P&gt;I need your help to create python script&amp;nbsp; to calculate the value of&amp;nbsp; the field that called "code" type short integer according to following condition:&lt;/P&gt;&lt;P&gt;def reclass(industrial_area):&lt;/P&gt;&lt;P&gt;if (industrial_area &amp;gt; two_third_neigh_area):&lt;/P&gt;&lt;P&gt;return 13&lt;/P&gt;&lt;P&gt;elif (industrial_area &amp;gt; one_third_neigh_area and industrial_area&amp;lt; two_third_neigh_area):&lt;/P&gt;&lt;P&gt;return 16&lt;/P&gt;&lt;P&gt;elif (industrial_area &amp;lt; one_third_neigh_area):&lt;/P&gt;&lt;P&gt;return unclassified&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I tried to apply the above if statement but I got this message:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FOUADHAMDAN_SAAD_0-1646982956226.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36126i73337ADFD537F384/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FOUADHAMDAN_SAAD_0-1646982956226.png" alt="FOUADHAMDAN_SAAD_0-1646982956226.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 07:48:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152853#M3549</guid>
      <dc:creator>FOUADHAMDAN_SAAD</dc:creator>
      <dc:date>2022-03-11T07:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator</title>
      <link>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152871#M3550</link>
      <description>&lt;P&gt;The def needs to have the other field names passed to it since it has no values for them.&amp;nbsp; You only pass the function 1 field name (industrial_area).&amp;nbsp; And I would check ArcMap's syntax for passing field names to functions eg do they need to be enclosed in square brackets, exclamation marks like in ArcGIS Pro)&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 10:02:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152871#M3550</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-03-11T10:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator</title>
      <link>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152879#M3551</link>
      <description>&lt;P&gt;You didn't include the other fields you were comparing in the function definition.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KimGarbade_0-1646994150351.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/36133iEE43CB9BC0539E39/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KimGarbade_0-1646994150351.png" alt="KimGarbade_0-1646994150351.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 10:23:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152879#M3551</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-03-11T10:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator</title>
      <link>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152885#M3552</link>
      <description>&lt;P&gt;In the reclass() function you have defined a single variable "&lt;SPAN&gt;&lt;STRONG&gt;industrial_area&lt;/STRONG&gt;", whereas you have called three variables in the code "&lt;STRONG&gt;industrial_area&lt;/STRONG&gt;", "&lt;STRONG&gt;one_third_neigh_area&lt;/STRONG&gt;", "&lt;STRONG&gt;two_third_neigh_area&lt;/STRONG&gt;".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You should add three variables in the function, and also define the appropriate fields in the expression.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Moreover, I don't understand "&lt;STRONG&gt;unclassified&lt;/STRONG&gt;"? If this is a value, it won't fit in a Short integer type. You could replace it with values like 0 or 99.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.: Assuming the layer has three numeric fields viz.,&amp;nbsp;&lt;SPAN&gt;"&lt;STRONG&gt;industrial_area&lt;/STRONG&gt;", "&lt;STRONG&gt;one_third_neigh_area&lt;/STRONG&gt;", "&lt;STRONG&gt;two_third_neigh_area&lt;/STRONG&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expression:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;reclass(!industrial_area!, !one_third_neigh_area!, !two_third_neigh_area!)&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Code Block:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def reclass(industrial_area, one_third_neigh_area, two_third_neigh_area):
    if (industrial_area &amp;gt; two_third_neigh_area):
        return 13
    elif ((industrial_area &amp;gt; one_third_neigh_area) and (industrial_area&amp;lt; two_third_neigh_area)):
        return 16
    elif (industrial_area &amp;lt; one_third_neigh_area):
        return 99&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 10:48:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152885#M3552</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2022-03-11T10:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator</title>
      <link>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152899#M3553</link>
      <description>&lt;P&gt;Thank you Sir.&lt;/P&gt;&lt;P&gt;I applied that and it is work perfectly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate all replays.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 13:01:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/field-calculator/m-p/1152899#M3553</guid>
      <dc:creator>FOUADHAMDAN_SAAD</dc:creator>
      <dc:date>2022-03-11T13:01:01Z</dc:date>
    </item>
  </channel>
</rss>

