AnsweredAssumed Answered

FieldMapings select specific fields from FC source

Question asked by jsn on Oct 18, 2018
Latest reply on Nov 28, 2018 by jsn

Hello everyone,


I have two feature classes I want to append, and I need to select the fields in fc2 that match the ones in fc1, because they do not have the same name, and both feature classes have different number of fields.


FC1 has the following fields: ID, ProjectID, Desc, TotalAmt
FC2 has the following fields:  ID , ProjectNumber, ProjectName, Description, Location, TotalAmount


How can I do in python to match fields from FC1 and FC2 that are going to be used for the append:
 - ID with ID
 - ProjectID with ProjectNumber
 - Desc with Description
 - TotalAmt with TotalAmount


fieldmappings = arcpy.FieldMappings()
fieldmappings.addTable(fc2)   ????  need a subset


arcpy.Append_management(FC2 ,  FC1, , "NO_TEST",  fieldmappings)