<?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 Using OR statement i Field Calculator in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045182#M25412</link>
    <description>&lt;P&gt;I am using ArcMAP 10.8 and i am trying to add a new field to a table. So far so good..&lt;/P&gt;&lt;P&gt;In this new field i want a&amp;nbsp; number between 1 and 5. The number is decided based on what is written in three other fields in the table ([MATERIAL], [YEAR] and [DIM]) So therefore i am using the Field Calculator. My problem is that i have never gotten the OR statement to work without writing the whole code again.&lt;/P&gt;&lt;P&gt;Therefore I have to write it like this to work:&lt;/P&gt;&lt;P&gt;dim n&lt;BR /&gt;if [DIM]=&amp;lt; 100 and [YEAR] =&amp;lt; 1959 and [MATERIAL] = "SJG" or&amp;nbsp; [DIM]=&amp;lt; 100 and [YEAR] =&amp;lt; 1959 and [MATERIAL] = "SJ" then&lt;BR /&gt;n = 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, I want to write it like this (or something similar);&lt;/P&gt;&lt;P&gt;dim n&lt;BR /&gt;if [DIM]=&amp;lt; 100 and [YEAR] =&amp;lt; 1959 and [MATERIAL] = "SJG", "SJ" then&lt;BR /&gt;n = 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really appriciate if there is some solution to this problem &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Apr 2021 18:10:28 GMT</pubDate>
    <dc:creator>GjermundDeggerdal</dc:creator>
    <dc:date>2021-04-08T18:10:28Z</dc:date>
    <item>
      <title>Using OR statement i Field Calculator</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045182#M25412</link>
      <description>&lt;P&gt;I am using ArcMAP 10.8 and i am trying to add a new field to a table. So far so good..&lt;/P&gt;&lt;P&gt;In this new field i want a&amp;nbsp; number between 1 and 5. The number is decided based on what is written in three other fields in the table ([MATERIAL], [YEAR] and [DIM]) So therefore i am using the Field Calculator. My problem is that i have never gotten the OR statement to work without writing the whole code again.&lt;/P&gt;&lt;P&gt;Therefore I have to write it like this to work:&lt;/P&gt;&lt;P&gt;dim n&lt;BR /&gt;if [DIM]=&amp;lt; 100 and [YEAR] =&amp;lt; 1959 and [MATERIAL] = "SJG" or&amp;nbsp; [DIM]=&amp;lt; 100 and [YEAR] =&amp;lt; 1959 and [MATERIAL] = "SJ" then&lt;BR /&gt;n = 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, I want to write it like this (or something similar);&lt;/P&gt;&lt;P&gt;dim n&lt;BR /&gt;if [DIM]=&amp;lt; 100 and [YEAR] =&amp;lt; 1959 and [MATERIAL] = "SJG", "SJ" then&lt;BR /&gt;n = 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really appriciate if there is some solution to this problem &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 18:10:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045182#M25412</guid>
      <dc:creator>GjermundDeggerdal</dc:creator>
      <dc:date>2021-04-08T18:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using OR statement i Field Calculator</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045206#M25413</link>
      <description>&lt;P&gt;I would use a python a script by setting the expression type to python.&lt;/P&gt;&lt;P&gt;Expression:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;reclass(!DIM!,!YEAR!,!MATERIAL!):&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;code block:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def reclass(dim, year, material):
    if dim &amp;lt;= 100 and year &amp;lt;= 1959 and material in ("SJG", "SJ"):
        return 5&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 12:35:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045206#M25413</guid>
      <dc:creator>Jelle_Stu_PR</dc:creator>
      <dc:date>2021-04-09T12:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using OR statement i Field Calculator</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045266#M25414</link>
      <description>&lt;P&gt;This has also worked for me (Parser: &lt;STRONG&gt;Python&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code Block:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def reclass(dim,year,material):
    if dim&amp;lt;=100 and year&amp;lt;=1959 and material in ("SJG","SJ"):
        return 5&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expression:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;reclass( !DIM!, !YEAR!, !MATERIAL! )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 05:41:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045266#M25414</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2021-04-09T05:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using OR statement i Field Calculator</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045365#M25415</link>
      <description>&lt;P&gt;Thank you very much for your helpfull respons! I am truly sorry if my follow-up questions are stupid and basic, but I`m stuck.&lt;/P&gt;&lt;P&gt;I have probably done something wrong, because I can`t get this command to work.&amp;nbsp; I wrote it in like this (Copy - paste from your post). Is there something more I have to add to the statement?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GjermundDeggerdal_0-1617951716737.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/10484i6ECC6EE2D25C5D8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GjermundDeggerdal_0-1617951716737.png" alt="GjermundDeggerdal_0-1617951716737.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And I dont understand why you don`t need exclamation marks around the variable inside the pre logic script, this seems diffrent then in VB Script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 07:15:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045365#M25415</guid>
      <dc:creator>GjermundDeggerdal</dc:creator>
      <dc:date>2021-04-09T07:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using OR statement i Field Calculator</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045366#M25416</link>
      <description>&lt;P&gt;In Pre-logic Script, it's just a variable name used in the function. In the expression those variable named get replaced by actual Field Names.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In Expression&lt;/STRONG&gt;, delete the fieldnames, and add them again by double-clicking the appropriate items in the Fields list, separated by comma.&lt;/P&gt;&lt;P&gt;Also you won't get any result, if the logic is not true for any record.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 07:40:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045366#M25416</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2021-04-09T07:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using OR statement i Field Calculator</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045392#M25417</link>
      <description>&lt;P&gt;Thanks, Your code worked perfect with copy-paste, the problem was that i had empty values "Null" and shape did not allow it. I converted it to gdb and it worked right away! Cheers!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 12:14:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/using-or-statement-i-field-calculator/m-p/1045392#M25417</guid>
      <dc:creator>GjermundDeggerdal</dc:creator>
      <dc:date>2021-04-09T12:14:20Z</dc:date>
    </item>
  </channel>
</rss>

