<?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: Copy feature class for selected field in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589214#M46160</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also you the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000020000000"&gt;Feature Class to Feature Class (conversion)&lt;/A&gt;&lt;SPAN&gt; tool.&amp;nbsp; This allows you to use the field map option:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;You can add, rename, or delete output fields as well as set properties such as data type and merge rule. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Aug 2012 13:32:32 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2012-08-02T13:32:32Z</dc:date>
    <item>
      <title>Copy feature class for selected field</title>
      <link>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589212#M46158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an existing code to copy feature class from sde to file geodatabase (using arcpy.FeatureClassToGeodatabase_conversion).&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Recently I have added a new field&amp;nbsp; feature classes in sde. My requirement is new field should not come to file geodatabase. Is it possible to copy a featureclass from sde to file geodatabase having selected fields only?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 12:58:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589212#M46158</guid>
      <dc:creator>AmlanRoy</dc:creator>
      <dc:date>2012-08-02T12:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Copy feature class for selected field</title>
      <link>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589213#M46159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;if you first use arcpy.MakeFeatureLayer to reference the data you want to copy to the gdb then you can do this by making use of the last optional argument called 'field info'.. the help for this tool says this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; A subset of fields can be made unavailable in the new layer by using the Field Info control's visible property. The third column in the control provides a dropdown option to specify whether a field will be visible or hidden in the new layer. The default is TRUE. Selecting FALSE will hide that field. You cannot use the hidden fields in a workflow if the newly created layer is input to a subsequent process or tool.&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: &amp;quot;#FF0000&amp;quot;;"&gt;If the output is saved to disk, only the fields listed as visible will appear in the new data&lt;/STRONG&gt;.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Depending on how many fields are involved, setting up the fields data in a digestible fashion into the 'field info' part of this tool can be very cumbersome. A work around for this is to set up a dummy modelbuilder tool to do this for you, manage the fields through the GUI then export the model to a script and then copy/past the MakeFeatureLayer command and arguments into your script. A bit of a kludge but given my typing skills this works fairly well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if the tool you are using accepts a feature layer as an input or wants a reference to a file on disk so that might alter your workflow a little. Is there a reason you are using the FeatureClassToGeodatabase_conversion tool rather than CopyFeatures?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 13:28:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589213#M46159</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-08-02T13:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Copy feature class for selected field</title>
      <link>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589214#M46160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also you the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000020000000"&gt;Feature Class to Feature Class (conversion)&lt;/A&gt;&lt;SPAN&gt; tool.&amp;nbsp; This allows you to use the field map option:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;You can add, rename, or delete output fields as well as set properties such as data type and merge rule. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 13:32:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589214#M46160</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-08-02T13:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Copy feature class for selected field</title>
      <link>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589215#M46161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found this example and made it even simpler. FC equals your feature class, fieldList equals what fields you want to keep. My&amp;nbsp;code is below.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080;"&gt;&lt;BR /&gt;&lt;BR /&gt;#Define function to take an input layer and output a layer with only a defined field list&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;def &lt;/SPAN&gt;filter_fields(FC, fieldList):&lt;BR /&gt;&lt;BR /&gt; &lt;SPAN style="color: #808080;"&gt;# List input fields&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; &lt;/SPAN&gt;fields= arcpy.ListFields(FC)&lt;BR /&gt;&lt;BR /&gt; &lt;SPAN style="color: #808080;"&gt;# Create a fieldinfo objects&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; &lt;/SPAN&gt;fieldinfo = arcpy.FieldInfo()&lt;BR /&gt;&lt;BR /&gt; &lt;SPAN style="color: #808080;"&gt;# Iterate over input fields, add them to the FieldInfo and hide them if&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; # they aren't in the list of fields to be kept&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;field &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;fields:&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if not &lt;/SPAN&gt;field.name &lt;SPAN style="color: #000080; font-weight: bold;"&gt;in &lt;/SPAN&gt;fieldList:&lt;BR /&gt;fieldinfo.addField(field.name, field.name, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"HIDDEN"&lt;/SPAN&gt;, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;""&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt; &lt;SPAN style="color: #808080;"&gt;# Copy features to a layer using the FieldInfo&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; &lt;/SPAN&gt;temp = &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"temp"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-weight: bold;"&gt; &lt;/SPAN&gt;arcpy.MakeFeatureLayer_management(FC, temp, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;""&lt;/SPAN&gt;, &lt;SPAN style="color: #008080; font-weight: bold;"&gt;""&lt;/SPAN&gt;, fieldinfo)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;#Call the function&lt;BR /&gt;&lt;/SPAN&gt;outFeature= &lt;SPAN style="color: #008080; font-weight: bold;"&gt;"admin3_AllJoined"&lt;BR /&gt;&lt;/SPAN&gt;filter_fields(outFeature,[&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Admin3_admin1Name"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Admin3_admin3Name"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Education_Table_Education_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Education_Table_Education"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Food_Table_Food_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Food_Table_Food_Fraction"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Healthcare_Table_Healthcare_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Healthcare_Table_Healthcare_Fraction"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Hygiene_Table_Hygiene_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Hygiene_Table_Hygiene_Fraction"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"NFI_Table_NFI_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"NFI_Table_NFI_Fraction"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Nutrition_Table_Nutrition_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Nutrition_Table_Nutrition_Fraction"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Protection_Table_Protection_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Protection_Table_Protection_Fraction"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Shelter_Table_Shelter_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Shelter_Table_Shelter_Fraction"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Water_Table_count"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Water_Table_Water_Percent"&lt;/SPAN&gt;,&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"Water_Table_Water_Fraction"&lt;/SPAN&gt;])&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;#arcpy.CopyFeatures_management(layerName,outFeature)&lt;BR /&gt;&lt;/SPAN&gt;arcpy.CopyFeatures_management(&lt;SPAN style="color: #008080; font-weight: bold;"&gt;"temp"&lt;/SPAN&gt;,outFeature2)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2018 09:05:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-feature-class-for-selected-field/m-p/589215#M46161</guid>
      <dc:creator>JessiePechmann2</dc:creator>
      <dc:date>2018-11-26T09:05:03Z</dc:date>
    </item>
  </channel>
</rss>

