<?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 Copy specific field values using python in ArcGIS Pro in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76544#M2686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all thanks for helping, and I realize I need some tutorials in python and can hopefully address that soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem: Using the Calculate Field tool I would like copy values from two other fields based on specific criteria. For instance I have a new field called "UnathorizedOccupantID". I would like to copy values from the field called "ClusterID", however when there is a value of -1 I would like to copy the corresponding values from the "SourceID" field. As seen here:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/456633_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this will get me to the next part of the analysis which is aggregating the cluster ID's using the Dissolve tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help it is greatly appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Aug 2019 18:08:00 GMT</pubDate>
    <dc:creator>nonipaulette</dc:creator>
    <dc:date>2019-08-08T18:08:00Z</dc:date>
    <item>
      <title>Copy specific field values using python in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76544#M2686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all thanks for helping, and I realize I need some tutorials in python and can hopefully address that soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem: Using the Calculate Field tool I would like copy values from two other fields based on specific criteria. For instance I have a new field called "UnathorizedOccupantID". I would like to copy values from the field called "ClusterID", however when there is a value of -1 I would like to copy the corresponding values from the "SourceID" field. As seen here:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/456633_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe this will get me to the next part of the analysis which is aggregating the cluster ID's using the Dissolve tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help it is greatly appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2019 18:08:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76544#M2686</guid>
      <dc:creator>nonipaulette</dc:creator>
      <dc:date>2019-08-08T18:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Copy specific field values using python in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76545#M2687</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/371973" target="_blank"&gt;noni,&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For future reference, when you have a question please post as a question not as a discussion.&amp;nbsp; You will get a better response from GeoNet. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can be easily completed using python in field calculator.&amp;nbsp; Create a function (uio), such as the following, which has a conditional statement that returns the ClusterID if it is not negative and otherwise returns the SourceID.&amp;nbsp; You can customize this as needed.&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;uio&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cluster&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; source&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; cluster &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; cluster
  &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; source‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You will call this using the statement&amp;nbsp;&lt;STRONG&gt;uio( !ClusterID!, !SourceID!)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the same shown in Field Calculator from ArcGIS Desktop.&amp;nbsp; It would be the same in Pro.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="456710" alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/456710_Capture.JPG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:57:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76545#M2687</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2021-12-10T22:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Copy specific field values using python in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76546#M2688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks alot for taking the time to resolve the task and the geonet tip. Greatly appreciated!&lt;/P&gt;&lt;P&gt;-Noni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2019 14:49:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76546#M2688</guid>
      <dc:creator>nonipaulette</dc:creator>
      <dc:date>2019-08-09T14:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Copy specific field values using python in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76547#M2689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lance im running into an issue where two fields are populating the new field with the same value. Here is a description below:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/459365_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code worked, however I need to tweak it so that the copied values are uniquely distinguishable.&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:50:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76547#M2689</guid>
      <dc:creator>nonipaulette</dc:creator>
      <dc:date>2019-09-12T15:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Copy specific field values using python in ArcGIS Pro</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76548#M2690</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/371973" target="_blank"&gt;noni paulette&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just modify the function as follows.&amp;nbsp; Make sure your 'UOID' field is set to text and not numeric.&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;uio&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;cluster&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; source&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; cluster &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'C%s'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;cluster
  &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; &lt;SPAN class="string token"&gt;'S%s'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt;source‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:57:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-specific-field-values-using-python-in-arcgis/m-p/76548#M2690</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2021-12-10T22:57:46Z</dc:date>
    </item>
  </channel>
</rss>

