<?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 Use Calcuate Field to replace values in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/use-calcuate-field-to-replace-values/m-p/234698#M8069</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to use the Field Calculator (python) to replace existing values (string) in Field1 with the values in Field2 (string) but only if Field2 is not Null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having trouble with the syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Sep 2019 15:17:46 GMT</pubDate>
    <dc:creator>JohnBrand</dc:creator>
    <dc:date>2019-09-19T15:17:46Z</dc:date>
    <item>
      <title>Use Calcuate Field to replace values</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/use-calcuate-field-to-replace-values/m-p/234698#M8069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to use the Field Calculator (python) to replace existing values (string) in Field1 with the values in Field2 (string) but only if Field2 is not Null.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having trouble with the syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 15:17:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/use-calcuate-field-to-replace-values/m-p/234698#M8069</guid>
      <dc:creator>JohnBrand</dc:creator>
      <dc:date>2019-09-19T15:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Use Calcuate Field to replace values</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/use-calcuate-field-to-replace-values/m-p/234699#M8070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/11527" target="_blank"&gt;John&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Field Calculator you will want to create a def statement in the code block and pass the values of Field1 and Field2 to this statement. &amp;nbsp;The Statement will look something like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;checkValue&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;f1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; f2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; f2 &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; f1
  &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; f2
‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would call the function using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;checkValue(!field1!, !field2!)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:51:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/use-calcuate-field-to-replace-values/m-p/234699#M8070</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2021-12-11T11:51:00Z</dc:date>
    </item>
  </channel>
</rss>

