<?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 FieldMap for Merging Selected Fields in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/fieldmap-for-merging-selected-fields/m-p/707865#M54851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use FieldMap in arcpy to merge only a few of the same fields from 8 feature classes. There are many different fields in all of the different feature classes, but I have identified the 9 fields I want in my final merged feature class. Instead of merging all the fields I identify it only chooses the first field in my list and I end up with a merged file with one field "COUNTY_F". What am I missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fClasses = []
i=0
fcs = arcpy.ListFeatureClasses()
for fc in fcs:&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; fClasses.append(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i+1
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
#Map Fields for Merge
inFields= ["COUNTY_F", "UNIQUE_ID", "TAXPAYER", "PARCEL_ID", "CURRENTUSE_CODE", "CURRENTUSE_DESC", "PRESENTUSE_CODE", "PRESENTUSE_DESC", "ACRES_ASSES"]
fm = arcpy.FieldMappings()
fm_type = arcpy.FieldMap()


for field in inFields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Clallam_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "GraysHarbor_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Jefferson_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "King_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Kittitas_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Mason_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Pierce_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Snohomish_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
fm.addFieldMap(fm_type)


arcpy.Merge_management(fClasses, "Merged", fm)
print "Merge: SUCCESS."&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:44:01 GMT</pubDate>
    <dc:creator>CarrieSchaden1</dc:creator>
    <dc:date>2021-12-12T05:44:01Z</dc:date>
    <item>
      <title>FieldMap for Merging Selected Fields</title>
      <link>https://community.esri.com/t5/python-questions/fieldmap-for-merging-selected-fields/m-p/707865#M54851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use FieldMap in arcpy to merge only a few of the same fields from 8 feature classes. There are many different fields in all of the different feature classes, but I have identified the 9 fields I want in my final merged feature class. Instead of merging all the fields I identify it only chooses the first field in my list and I end up with a merged file with one field "COUNTY_F". What am I missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fClasses = []
i=0
fcs = arcpy.ListFeatureClasses()
for fc in fcs:&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; fClasses.append(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i+1
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
#Map Fields for Merge
inFields= ["COUNTY_F", "UNIQUE_ID", "TAXPAYER", "PARCEL_ID", "CURRENTUSE_CODE", "CURRENTUSE_DESC", "PRESENTUSE_CODE", "PRESENTUSE_DESC", "ACRES_ASSES"]
fm = arcpy.FieldMappings()
fm_type = arcpy.FieldMap()


for field in inFields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Clallam_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "GraysHarbor_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Jefferson_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "King_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Kittitas_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Mason_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Pierce_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_type.addInputField( "Snohomish_WorkingForest_2013", field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
fm.addFieldMap(fm_type)


arcpy.Merge_management(fClasses, "Merged", fm)
print "Merge: SUCCESS."&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:44:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fieldmap-for-merging-selected-fields/m-p/707865#M54851</guid>
      <dc:creator>CarrieSchaden1</dc:creator>
      <dc:date>2021-12-12T05:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: FieldMap for Merging Selected Fields</title>
      <link>https://community.esri.com/t5/python-questions/fieldmap-for-merging-selected-fields/m-p/707866#M54852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the fields in the featureclasses are all named the same, I guess you don't have to use field mapping... You could simply merge the featureclasses together and then remove any redundant fields...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 02:33:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fieldmap-for-merging-selected-fields/m-p/707866#M54852</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-01-08T02:33:24Z</dc:date>
    </item>
  </channel>
</rss>

