<?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 Re: arcpy FieldMappings input table in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-fieldmappings-input-table/m-p/1577093#M73582</link>
    <description>&lt;P&gt;Thanks for detailing what the parameters are for the field mappings object. Do you mind sharing a link to where you found this information in the documentation?&lt;/P&gt;</description>
    <pubDate>Sun, 19 Jan 2025 23:45:12 GMT</pubDate>
    <dc:creator>MK13</dc:creator>
    <dc:date>2025-01-19T23:45:12Z</dc:date>
    <item>
      <title>arcpy FieldMappings input table</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-fieldmappings-input-table/m-p/1310772#M68224</link>
      <description>&lt;P&gt;Arcpy FieldMappings documentation includes the path to the input table which can be seen in the following string representation as &lt;SPAN class=""&gt;c:\\data\\fgdb.gdb\\south_america&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;fieldmappings_string = 'REGION "Region" true true false 21 Text -1 -1,First,#,c:\\data\\fgdb.gdb\\north_america,REGION,-1,-1,c:\\data\\fgdb.gdb\\south_america,REGION2,-1,-1'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the case of arcpy ExportFeatures both in_features and field_mappings will include path to input table.&lt;/P&gt;&lt;PRE&gt;arcpy.conversion.ExportFeatures(in_features, out_features, &lt;BR /&gt;    {where_clause}, {use_field_alias_as_name}, {field_mapping}, {sort_field})&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This makes me wonder a few things.&amp;nbsp; What if the input tables between 'in_features' and 'field_mapping' did not match?&amp;nbsp; If they must match, then why doesn't fieldmappings inherit the input path from in_features?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Tyler&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2023 13:50:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-fieldmappings-input-table/m-p/1310772#M68224</guid>
      <dc:creator>TylerT</dc:creator>
      <dc:date>2023-07-22T13:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy FieldMappings input table</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-fieldmappings-input-table/m-p/1310793#M68228</link>
      <description>&lt;P&gt;The input needs to match or you will get an error that says it cant find the field in the featureclass specified. Think about it though, if you try to use a field from another featureclass, how would it know which value goes to what feature? What if there are more or less values from that other featureclass?&lt;/P&gt;&lt;P&gt;It does inherit the path if you do not set the optional field mapping parameter. If you want to drop/rename fields, you'll need to use the field_mapping parameter.&lt;/P&gt;&lt;P&gt;----------&lt;/P&gt;&lt;P&gt;Right below that example, which is for a &lt;STRONG&gt;&lt;EM&gt;merge (so there are two inputs&lt;/EM&gt;&lt;/STRONG&gt;), there is a key that could shed some light into this. Lets split this string up to match the help.&lt;/P&gt;&lt;P&gt;The first nine values in the string define an output field and are space delimited.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;'REGION "Region" true true false 21 Text -1 -1,&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;The name of the output field. -&amp;gt; REGION&lt;/LI&gt;&lt;LI&gt;The alias of the output field. -&amp;gt; Region&lt;/LI&gt;&lt;LI&gt;Whether the output field is editable (&lt;SPAN class=""&gt;true&lt;/SPAN&gt; or &lt;SPAN class=""&gt;false&lt;/SPAN&gt;). -&amp;gt; true&lt;/LI&gt;&lt;LI&gt;Whether the output field supports nulls (&lt;SPAN class=""&gt;true&lt;/SPAN&gt; or &lt;SPAN class=""&gt;false&lt;/SPAN&gt;). -&amp;gt; true&lt;/LI&gt;&lt;LI&gt;Whether the output field is required (&lt;SPAN class=""&gt;true&lt;/SPAN&gt; or &lt;SPAN class=""&gt;false&lt;/SPAN&gt;). -&amp;gt; false&lt;/LI&gt;&lt;LI&gt;The length of the output field (text fields only). -&amp;gt; 21&lt;/LI&gt;&lt;LI&gt;The field type of the output field. -&amp;gt; Text&lt;/LI&gt;&lt;LI&gt;The precision of the output field (float and double fields only). -&amp;gt; -1&lt;/LI&gt;&lt;LI&gt;The scale of the output field (float and double fields only). -&amp;gt; -1&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The remaining values define the field map characteristics and are comma delimited.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;First,#,c:\\data\\fgdb.gdb\\north_america,REGION,-1,-1,c:\\data\\fgdb.gdb\\south_america,REGION2,-1,-1'&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The field map merge rule. -&amp;gt; First&lt;/LI&gt;&lt;LI&gt;The concatenator to join values. -&amp;gt; Skipped&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;The path to the input table&lt;STRONG&gt;(s)&lt;/STRONG&gt;. -&amp;gt; &lt;SPAN class=""&gt;c:\\data\\fgdb.gdb\\north_america&lt;/SPAN&gt;, &lt;SPAN class=""&gt;c:\\data\\fgdb.gdb\\south_america, ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;The field name from the input table&lt;STRONG&gt;(s)&lt;/STRONG&gt;.-&amp;gt; REGION, REGION2, ...&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;The start position of an input text value&lt;EM&gt;&lt;STRONG&gt;(s)&lt;/STRONG&gt;&lt;/EM&gt;. -&amp;gt; -1, -1, ...&lt;/LI&gt;&lt;LI&gt;The end position of an input text value&lt;EM&gt;&lt;STRONG&gt;(s)&lt;/STRONG&gt;&lt;/EM&gt;. -&amp;gt; -1, -1, ...&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any number of input fields can be mapped to the output field, &lt;STRONG&gt;&lt;EM&gt;not only two, as implied in the example&lt;/EM&gt;&lt;/STRONG&gt;. Include the merge rule and concatenator once, and include the dataset path, field name, and start position and end position for each input field.&lt;/P&gt;&lt;P&gt;You can see how confusing the string representation can get and I have yet to come into a need to code it that way.&amp;nbsp;I added the emphasis because its a bit hidden in the docs but is key here. Hope this helps.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2023 03:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-fieldmappings-input-table/m-p/1310793#M68228</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2023-07-23T03:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy FieldMappings input table</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-fieldmappings-input-table/m-p/1577093#M73582</link>
      <description>&lt;P&gt;Thanks for detailing what the parameters are for the field mappings object. Do you mind sharing a link to where you found this information in the documentation?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2025 23:45:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-fieldmappings-input-table/m-p/1577093#M73582</guid>
      <dc:creator>MK13</dc:creator>
      <dc:date>2025-01-19T23:45:12Z</dc:date>
    </item>
  </channel>
</rss>

