<?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: Evaluating two fields and assigning value in a third? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/evaluating-two-fields-and-assigning-value-in-a/m-p/106215#M8200</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Update cursor is a good way to do it, but&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;some pre-logic code in the field calculator would work too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if ([Field1] &amp;gt;= 100 and [Field1] &amp;lt;= 200) and [Field2] = 11 then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; theValue = "red"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; theValue = [Field3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end if&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[Field3] = theValue&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jan 2012 18:05:15 GMT</pubDate>
    <dc:creator>markdenil</dc:creator>
    <dc:date>2012-01-27T18:05:15Z</dc:date>
    <item>
      <title>Evaluating two fields and assigning value in a third?</title>
      <link>https://community.esri.com/t5/python-questions/evaluating-two-fields-and-assigning-value-in-a/m-p/106213#M8198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I've reached a point where I need a Python script but I'm not sure exactly how to proceed. This is what I would like to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the value in Field1 is between 100 and 200 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the value in Field2 is 11, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;then Field3 is calculated to "red" &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and so on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've found a few code examples but I'm not sure where to execute - can I do this in the field calculator? the raster calculator? or do I need a stand alone script?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once I figure this out, then I will try to tackle the code!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any pointers.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 17:23:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/evaluating-two-fields-and-assigning-value-in-a/m-p/106213#M8198</guid>
      <dc:creator>SaraJK</dc:creator>
      <dc:date>2012-01-27T17:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating two fields and assigning value in a third?</title>
      <link>https://community.esri.com/t5/python-questions/evaluating-two-fields-and-assigning-value-in-a/m-p/106214#M8199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would use an upate cursor. Something like this might work&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;cur = gp.UpdateCursor(insertnameoffeatureclass)
row = cur.Next()
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.Field1 &amp;gt;= 100 and row.Field1 &amp;lt;= 200 and row.Field2 == 11:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Field3 = "red"
&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.UpdateRow(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.Next()
del cur, row&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:28:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/evaluating-two-fields-and-assigning-value-in-a/m-p/106214#M8199</guid>
      <dc:creator>JeremyLuymes</dc:creator>
      <dc:date>2021-12-11T06:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Evaluating two fields and assigning value in a third?</title>
      <link>https://community.esri.com/t5/python-questions/evaluating-two-fields-and-assigning-value-in-a/m-p/106215#M8200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Update cursor is a good way to do it, but&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;some pre-logic code in the field calculator would work too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if ([Field1] &amp;gt;= 100 and [Field1] &amp;lt;= 200) and [Field2] = 11 then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; theValue = "red"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; theValue = [Field3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end if&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[Field3] = theValue&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 18:05:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/evaluating-two-fields-and-assigning-value-in-a/m-p/106215#M8200</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2012-01-27T18:05:15Z</dc:date>
    </item>
  </channel>
</rss>

