<?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: Deleting Global ID field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/deleting-global-id-field/m-p/608116#M47458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't been able to figure this out. Created a work around where I have an empty template feature class and gdb stored locally that has only the fields I want to retain, and the python script now copies the template and appends the data to the copy. This is then used for the final upload process that I've been trying achieve (that didn't like the Global ID field).&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Nov 2019 07:59:33 GMT</pubDate>
    <dc:creator>LindsayRaabe_FPCWA</dc:creator>
    <dc:date>2019-11-21T07:59:33Z</dc:date>
    <item>
      <title>Deleting Global ID field</title>
      <link>https://community.esri.com/t5/python-questions/deleting-global-id-field/m-p/608115#M47457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've got a feature class that I am trying to remove the Global ID and editor information fields from. So far, the best way I can figure out is to create a new version of the&amp;nbsp;feature class&amp;nbsp;without the fields and append the data across. I've tried the following code I found online and tweaked, but am stuck on the field mapping.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The input FC is "Prod_Temp" and I want the output to be "Prod_Sync". The fields listed in myfields are the fields in "Prod_Temp" that I want to retain. When I run the script, it complains about something around Line 10. I think I'm misunderstanding the input option for map.addInputField(existingFC, field).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any pointers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# feature class I want to copy from&lt;/SPAN&gt;
existingFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"W:\TEMP\Prod_Temp.gdb\Prod_Temp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# list of fields I want to keep (capitalization counts!)&lt;/SPAN&gt;
myfields &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'FPCBusinessArea'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Location'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OpType'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OperationStatus'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Contractor'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ContractorSupervisor'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'SupervisorPhone'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'FPCOIC'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'FPCOICPhone'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Machinery'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Comments'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# create an empty field mapping object&lt;/SPAN&gt;
mapS &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FieldMappings&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# for each field, create an individual field map, and add it to the field mapping object&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; myfields &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    map &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FieldMap&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addInputField&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;existingFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; field&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    mapS&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addFieldMap&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;map&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# copy the feature class using the fields you want&lt;/SPAN&gt;
Prod_Sync &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;FeatureClassToFeatureClass_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;existingFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"W:\TEMP\Prod_Sync.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Prod_Sync"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; mapS&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&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;/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;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>Sun, 12 Dec 2021 02:01:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-global-id-field/m-p/608115#M47457</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2021-12-12T02:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Global ID field</title>
      <link>https://community.esri.com/t5/python-questions/deleting-global-id-field/m-p/608116#M47458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't been able to figure this out. Created a work around where I have an empty template feature class and gdb stored locally that has only the fields I want to retain, and the python script now copies the template and appends the data to the copy. This is then used for the final upload process that I've been trying achieve (that didn't like the Global ID field).&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2019 07:59:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-global-id-field/m-p/608116#M47458</guid>
      <dc:creator>LindsayRaabe_FPCWA</dc:creator>
      <dc:date>2019-11-21T07:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Global ID field</title>
      <link>https://community.esri.com/t5/python-questions/deleting-global-id-field/m-p/608117#M47459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried your code without issue.&amp;nbsp; An error at line 10 would suggest that either existingFC was not found or myfields contains a field name that is not in existingFC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In either case the message would be:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;RuntimeError: FieldMap: Error in adding input field to field map&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could add a&amp;nbsp;section to read the fields in your feature, and if they are in your field list, then add them to the field map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 04:22:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/deleting-global-id-field/m-p/608117#M47459</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2019-11-26T04:22:49Z</dc:date>
    </item>
  </channel>
</rss>

