<?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 a field from one shapefile to another in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122336#M4259</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hiyo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm just getting started with Esri's geoprocessing tools and I've got a fairly basic question.&amp;nbsp; I'm trying to copy the value from a field in one shapefile to another shapefile.&amp;nbsp; The field already exists in both shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried a couple of approaches.&amp;nbsp; My first approach was to &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#Make first shapefile into a feature layer so join will work
gp.MakeFeatureLayer_management(shapefile_one_path, shapefile_one_name)

# Join the Shapefiles
gp.AddJoin_management(shapefile_one_name, join_field, shapefile_two_name, join_field, "KEEP_COMMON")

# Then I write the new joined table to disk so I can run calculate field on it.
gp.Select_analysis(shapefile_one_name, "joined_shapefile.shp", "")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, this approach dorked up all of column names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next, I tried to update the column on the joined table:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#Make first shapefile into a feature layer so join will work
gp.MakeFeatureLayer_management(shapefile_one_path, shapefile_one_name)

# Join the Shapefiles
gp.AddJoin_management(shapefile_one_name, join_field, shapefile_two_name, join_field, "KEEP_COMMON")

# Calculate field...?
gp.CalculateField_management(shapefile_one_name, "field_to_update", "field_to_copy")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This resulted in a "general function failure."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anybody have any tips?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jan 2012 13:46:59 GMT</pubDate>
    <dc:creator>danielporter1</dc:creator>
    <dc:date>2012-01-06T13:46:59Z</dc:date>
    <item>
      <title>copy a field from one shapefile to another</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122336#M4259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hiyo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm just getting started with Esri's geoprocessing tools and I've got a fairly basic question.&amp;nbsp; I'm trying to copy the value from a field in one shapefile to another shapefile.&amp;nbsp; The field already exists in both shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried a couple of approaches.&amp;nbsp; My first approach was to &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#Make first shapefile into a feature layer so join will work
gp.MakeFeatureLayer_management(shapefile_one_path, shapefile_one_name)

# Join the Shapefiles
gp.AddJoin_management(shapefile_one_name, join_field, shapefile_two_name, join_field, "KEEP_COMMON")

# Then I write the new joined table to disk so I can run calculate field on it.
gp.Select_analysis(shapefile_one_name, "joined_shapefile.shp", "")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, this approach dorked up all of column names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next, I tried to update the column on the joined table:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#Make first shapefile into a feature layer so join will work
gp.MakeFeatureLayer_management(shapefile_one_path, shapefile_one_name)

# Join the Shapefiles
gp.AddJoin_management(shapefile_one_name, join_field, shapefile_two_name, join_field, "KEEP_COMMON")

# Calculate field...?
gp.CalculateField_management(shapefile_one_name, "field_to_update", "field_to_copy")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This resulted in a "general function failure."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anybody have any tips?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 13:46:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122336#M4259</guid>
      <dc:creator>danielporter1</dc:creator>
      <dc:date>2012-01-06T13:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: copy a field from one shapefile to another</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122337#M4260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I might have a possible solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For your second option, in the final calculate field, you need to add the layer in the field to copy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lets say shape1 and shape2 are your shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.CalculateField(shape1,"shape1.field_to_update","[shape2.field_to_copy]","VB") &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This usually works for me. You might need to make both your shapefiles into layers.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 14:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122337#M4260</guid>
      <dc:creator>JeremyLuymes</dc:creator>
      <dc:date>2012-01-06T14:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: copy a field from one shapefile to another</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122338#M4261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeremy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&amp;nbsp; That worked perfectly.&amp;nbsp; I did not have to make the second shapefile into a layer; I just fixed the syntax of my CalculateField call and it went off without a hitch.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This saves me so much clicking!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Daniel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 15:09:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122338#M4261</guid>
      <dc:creator>danielporter1</dc:creator>
      <dc:date>2012-01-06T15:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: copy a field from one shapefile to another</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122339#M4262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Check the qualified field names environment setting,&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001w00000008000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001w00000008000000&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;I think it might solve the quirky file.fieldname issue that you allude to&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2012 15:09:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/copy-a-field-from-one-shapefile-to-another/m-p/122339#M4262</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2012-01-06T15:09:57Z</dc:date>
    </item>
  </channel>
</rss>

