<?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: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207928#M15996</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you're iterating a list of feature classes, opening the search cursor on each one, and exporting certain ObjectIDs in the whole feature class based on the ObjectIDs listed in the UTM_Grid field of each record? Seems like that would be ripe for duplicates. Could you upload some sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Apr 2016 17:27:15 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2016-04-28T17:27:15Z</dc:date>
    <item>
      <title>Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207923#M15991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider a Feature Class (part of an Enterprise GDB content) and two of its fields are "UTM_grid" and the "OID".&lt;/P&gt;&lt;P&gt;Scripting with python 2.7 for ArcGIS 10.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"UTM_grid" field was broken down into "UTM_block" + "UTM_sheet" and then using a dictionary and list structure UTM_block--&amp;gt;UTM_sheet--&amp;gt;OID was organized with this syntax:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;{ 'UTM_block_1' : { 'UTM_sheet_A' : [ oid_1 , oid_2 ] }, { UTM_sheet_2 : [ oid_3 , oid_4, oid_5 ] } }&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We need to create **shapefiles** with features (identified by the object value - oid) based on the follow data structure (OIDs will be organized regarding an UTM/location based structure):&lt;/P&gt;&lt;P&gt;- UTM_block_* will be a folder&lt;/P&gt;&lt;P&gt;- UTM-sheet_* its subfolder.&lt;/P&gt;&lt;P&gt;- List of objects (OIDs) will populate the shapefile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;Another point we have to deal with is that the shapefile should only have some fields of the original Feature Class:&lt;/P&gt;&lt;P&gt;We have used fieldmappings and arcpy.FeatureClassToFeatureClass_conversion() to create a non-UTM-organized shapefile from a Feature Class with the fields that we need.&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the problem is how to process the **feature export** to get UTM-organized shapefiles! How can we manage it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bellow is what we have now inside a function:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(feature_class, ['UTM_grid , 'OBJECTID']) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dic = dict()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UTM_grid_value = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oid_value = row[1]

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b_s_split = UTM_grid_value.split('_')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # split into block &amp;amp; sheet

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception, e:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(UTM_grid_value)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(e)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # create folders &amp;amp; subfolders (blocks &amp;amp; sheets) in a directory
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dic.setdefault( b_s_split[0], {} ).setdefault( b_s_split[1], [] ).append( oid_value )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="line-height: 26px;"&gt;dir_path = os.path.dirname("E:\\")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # full path to directory&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dirs = [ [b_s_split[0]] , [b_s_split[1]] ]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for item in itertools.product(*dirs):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not os.path.isdir(os.path.join(dir_path, *item)):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.makedirs(os.path.join(dir_path, *item))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:16:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207923#M15991</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2021-12-11T10:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class to Shapefile into a Data Structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207924#M15992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I must be missing where the features to export is coming from assuming that creates the necessary folder structure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Apr 2016 09:55:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207924#M15992</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-04-26T09:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class to Shapefile into a Data Structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207925#M15993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson &lt;/A&gt;&lt;A href="https://community.esri.com/migrated-users/48550"&gt;Blake Terhune&lt;/A&gt;​​&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Features classes to export are in a SDE geodatabase. We read/list the FCs in that GDB and for each FC we need to process the export of its features by UTM block-sheet into shapefiles.&lt;/P&gt;&lt;P&gt;The FC includes a field which identifies the location (as shown in code).&lt;/P&gt;&lt;P&gt;e.g. B1SD40B --&amp;gt; breaking down into "block" + "sheet" results in "B1" + "SD40B".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at the fields "&lt;STRONG&gt;UTM_grid&lt;/STRONG&gt;" and "&lt;STRONG&gt;ObjectID&lt;/STRONG&gt;" we check while sheet ( utm_grid[1] ) = "&lt;SPAN style="font-size: 15px;"&gt;SD40B&lt;/SPAN&gt;", read the corresponding OID, and put the Feature into a Shapefile inside the directory (which has the associated sheet name). The same logic could be used to organize sheets inside the block directories.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Apr 2016 10:15:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207925#M15993</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2016-04-26T10:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class to Shapefile into a Data Structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207926#M15994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt; is asking how you find the feature class to export? In other words, how do we know where to go to export the OIDs for each sheet. Is there something in the UTM grid data that identifies the feature class to export?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2016 23:59:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207926#M15994</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-04-27T23:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207927#M15995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My comment was edited to clarify that point, thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 16:26:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207927#M15995</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2016-04-28T16:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207928#M15996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you're iterating a list of feature classes, opening the search cursor on each one, and exporting certain ObjectIDs in the whole feature class based on the ObjectIDs listed in the UTM_Grid field of each record? Seems like that would be ripe for duplicates. Could you upload some sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 17:27:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207928#M15996</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-04-28T17:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207929#M15997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/48550"&gt;Blake Terhune&lt;/A&gt; yes, we want to export certain OIDs from the whole FC, but that selection is based on the "childs" derived from the "parent" UTM_grid. Childs mean block and its sheets.&lt;/P&gt;&lt;P&gt;Am sending you a simplified FC (polygon) we are using for test which already has the attributes we need.&lt;/P&gt;&lt;P&gt;FOL_250K is a short name for FOLHA (meaning sheet) and 250K (is the scale). I posted the question replacing FOL_250K by UTM_grid. So consider the real name as you need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/s/7z6m4rgij3lxlyu/gdb2shp_selected_fields.gdb.zip?dl=0"&gt;https://www.dropbox.com/s/7z6m4rgij3lxlyu/gdb2shp_selected_fields.gdb.zip?dl=0&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:19:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207929#M15997</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2016-04-28T18:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207930#M15998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I still don't quite follow. I don't see a UTM_grid field in the data you uploaded, nor do I see any lists of OIDs. Do you have some other Python function that dissolves the FOL_250K field into OIDs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like there are four distinct values in FOL_250K:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;BLOCO1 - SULD33S - Namibe&lt;/P&gt;&lt;P&gt;BLOCO1 - SULD33T - Chibia&lt;/P&gt;&lt;P&gt;BLOCO1 - SULE33B - Oncócua&lt;/P&gt;&lt;P&gt;BLOCO3 - SULC33U&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Should it make output folders and shapefiles like this?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;BLOCO1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.. SULD33S&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.... Namibe.shp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.. SULD33T&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.... Chibia.shp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.. SULD33B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.... Oncócua.shp&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;BLOCO3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.. SULC33U&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;.... None.shp&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 18:28:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207930#M15998</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-04-28T18:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207931#M15999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/48550" target="_blank"&gt;Blake Terhune&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;When I posted the problem I wrote "UTM_grid" to give it a more readable name &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The file/FC contains the real names. FOL_250K is UTM_grid.&lt;/P&gt;&lt;P&gt;FOL_250K shows those labels (e.g.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; font-size: 15px; background-color: #f6f6f6;"&gt;BLOCO1 - SULD33T - Chibia)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;but the value is B1_SULD33T.&amp;nbsp; We do not need to dissolve FOL_250K.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;with arcpy.da.SearchCursor(gab_und_crt_dic, ['FOL_250K' , 'OBJECTID']) as cursor:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fol_250k_value = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oid_value = row[1]&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fol_250k_value returns a value in the format (&lt;SPAN style="font-size: 15px;"&gt;B1_SULD33T).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Output structure we need:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;B1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;.. SULD33S&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;.... B1_SULD33S_&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;lt;featureClassName&amp;gt;&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit;"&gt;.shp&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;.. SULD33T&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;.... &lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 15px;"&gt;B1_SULD33T_&lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 15px;"&gt;&lt;STRONG&gt;&amp;lt;featureClassName&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;.shp&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;B3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 15px; font-family: 'courier new', courier;"&gt;.. &lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 15px;"&gt;SULC33U&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-weight: inherit; font-size: 15px; font-family: 'courier new', courier; font-style: inherit;"&gt;.... B3_&lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 15px;"&gt;SULC33U_&lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 15px;"&gt;&lt;STRONG&gt;&amp;lt;featureClassName&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt;.shp&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 15px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;(in this case &lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 15px;"&gt;&lt;STRONG&gt;&amp;lt;featureClassName&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt; will be gab_und_crt_dic)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207931#M15999</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2021-12-11T10:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207932#M16000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the value in the &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;FOL_250K field of the &lt;/SPAN&gt;sample data you uploaded is not correct? It's hard to parse a value when you don't know what the value is supposed to look like. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;Are you saying instead of the value being &lt;SPAN style="font-family: 'courier new', courier;"&gt;BLOCO1 - SULD33T - Chibia&lt;/SPAN&gt;, it should be &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;B1SULD33T&lt;/SPAN&gt;? How do you parse that into block and sheet? At the first &lt;SPAN style="font-family: 'courier new', courier;"&gt;S&lt;/SPAN&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 20:56:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207932#M16000</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-04-28T20:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207933#M16001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/48550"&gt;Blake Terhune&lt;/A&gt;​​&lt;/P&gt;&lt;P&gt;Missed the "&lt;STRONG&gt;_&lt;/STRONG&gt;" in the field.&lt;/P&gt;&lt;P&gt;FOL_250K returns the correct value.&lt;/P&gt;&lt;P&gt;If you run the snippet above with that variable/FC, fol_250k_value = B3_SULC33U &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 22:12:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207933#M16001</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2016-04-28T22:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207934#M16002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this close? I'm assuming that you can parse based on the index of "S" in FOL_250K. I'm also assuming you want all fields in the feature class exported to the shapefile.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

def main():
&amp;nbsp;&amp;nbsp;&amp;nbsp; # local variables
&amp;nbsp;&amp;nbsp;&amp;nbsp; root_dir = r"C:\temp\Msg605039"
&amp;nbsp;&amp;nbsp;&amp;nbsp; gdb = os.path.join(root_dir, "gdb2shp_selected_fields.gdb")
&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class = os.path.join(gdb, "gab_und_crt_dic")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get list of distinct UTM values
&amp;nbsp;&amp;nbsp;&amp;nbsp; utm_field = "FOL_250K"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sql_prefix = "DISTINCT {}".format(utm_field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; sql_suffix = None
&amp;nbsp;&amp;nbsp;&amp;nbsp; distinct_utm = [
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i[0] for i in arcpy.da.SearchCursor(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class, utm_field, sql_clause=(sql_prefix, sql_suffix)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )
&amp;nbsp;&amp;nbsp;&amp;nbsp; ]

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create folders and export features to shapefiles for each UTM value
&amp;nbsp;&amp;nbsp;&amp;nbsp; for utm in distinct_utm:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delim = "S"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delim_index = utm.find(delim)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if delim_index == -1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise Exception("Could not parse {} with {}".format(utm, delim))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; block = utm[0:delim_index]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sheet = utm[delim_index:len(utm)]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sheet_path = os.path.join(root_dir, block, sheet)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not os.path.exists(sheet_path):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.makedirs(sheet_path)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class,&amp;nbsp; ## in_features
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sheet_path,&amp;nbsp; ## out_path
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "{}_{}_{}".format(block, sheet, os.path.basename(feature_class)),&amp;nbsp; ## out_name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "FOL_250K = '{}'".format(utm)&amp;nbsp; ## where_clause
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )


if __name__ == "__main__":
&amp;nbsp;&amp;nbsp;&amp;nbsp; main()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:16:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207934#M16002</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T10:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207935#M16003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haha, you're killing me! So if it should look like &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;B3_SULC33U&lt;/SPAN&gt; and you want to parse on the first underscore, then you can replace that last section with this (untested):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Create folders and export features to shapefiles for each UTM value
for utm in distinct_utm:
&amp;nbsp;&amp;nbsp;&amp;nbsp; delim = "_"
&amp;nbsp;&amp;nbsp;&amp;nbsp; utm_parse = utm.split(delim, 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if len(utm_parse) == 2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; block, sheet = utm_parse
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sheet_path = os.path.join(root_dir, block, sheet)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not os.path.exists(sheet_path):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; os.makedirs(sheet_path)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class,&amp;nbsp; ## in_features
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sheet_path,&amp;nbsp; ## out_path
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "{}_{}_{}".format(block, sheet, os.path.basename(feature_class)),&amp;nbsp; ## out_name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "FOL_250K = '{}'".format(utm)&amp;nbsp; ## where_clause
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise ValueError("Could not parse {} with {}".format(utm, delim))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:16:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207935#M16003</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T10:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207936#M16004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/48550"&gt;Blake Terhune&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;Made 2 adjustments to get what we need.&lt;/P&gt;&lt;P&gt;Line 22&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;delim = &lt;/SPAN&gt;&lt;SPAN class="string" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: blue; background-color: #f6f6f6;"&gt;"_"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Line 28&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;delim_index+1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f6f6f6;"&gt;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/cool.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 23:48:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207936#M16004</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2016-04-28T23:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207937#M16005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See my edited reply &lt;A _jive_internal="true" href="https://community.esri.com/thread/176153#comment-605411"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 23:51:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207937#M16005</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-04-28T23:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207938#M16006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/48550" target="_blank"&gt;Blake Terhune&lt;/A&gt;​&lt;/P&gt;&lt;P&gt;That is it thank you &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;I am glad you could survive to it &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt; Another question-opinion related with this geoprocessing.&lt;/P&gt;&lt;P&gt;The real FCs we have in the SDE have more fields other than those in the file attached to this post.&lt;/P&gt;&lt;P&gt;The most complex FC has a relation with a Table. We investigated FC and Table attributes to get those to build the join. Creating a lyr of the FC we processed the join of it with the Table.&lt;/P&gt;&lt;P&gt;Then using &lt;SPAN style="font-size: 15px;"&gt;fieldmappings we defined the fields we wanted to keep in the final FC (the one attached) as this snippet shows :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;ws = "path to workspace"
fieldmappings = arcpy.FieldMappings()
fieldmappings.addTable(os.path.join(ws, gab_und_crt_dic[0]))

for inputfield in fieldmappings.fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if inputfield.name not in ["ID_UND_CRT","st_UND_GEOL","DSCR_UND_CRT","DSCR_UND_CRT_LG","FOL_250K","ID_UND_LITO",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DSCR_UND_GEOL", "DSCR_UND_LITO", "IDE_CRON_INF", "IDE_CRON_SUP"]:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldmappings.removeFieldMap(fieldmappings.findFieldMapIndex(inputfield.name))
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # export FC with selected fields to shp
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(gab_und_crt_dic[0], gdb2shp_selected_fields.gdb, "gab_und_crt_dic", field_mapping = fieldmappings)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you take this approach or another way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:16:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207938#M16006</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2021-12-11T10:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207939#M16007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the code you posted, you're not actually joining a table, only limiting the fields that are exported from whatever &lt;SPAN style="font-family: 'courier new', courier;"&gt;gab_und_crt_dic[0]&lt;/SPAN&gt; is. If that's the case, then your code is fine. An alternative method would be to only add the field maps you want from the start instead of adding everything, then going through each one to remove what doesn't belong.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;ws = "path to workspace"
fc_path = os.path.join(ws, gab_und_crt_dic[0])
out_fields = [
&amp;nbsp;&amp;nbsp;&amp;nbsp; "ID_UND_CRT",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "st_UND_GEOL",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "DSCR_UND_CRT",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "DSCR_UND_CRT_LG",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "FOL_250K",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "ID_UND_LITO",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "DSCR_UND_GEOL",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "DSCR_UND_LITO",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "IDE_CRON_INF",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "IDE_CRON_SUP"
]
# Build field mappings with only desired fields
fieldmappings = arcpy.FieldMappings()
for field in out_fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_obj = arcpy.FieldMap()
&amp;nbsp;&amp;nbsp;&amp;nbsp; fm_obj.addInputField(fc_path, field)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldmappings.addFieldMap(fm_obj)
&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;# Export feature class with field mappings&lt;/SPAN&gt;
arcpy.FeatureClassToFeatureClass_conversion(
&amp;nbsp;&amp;nbsp;&amp;nbsp; bla,
&amp;nbsp;&amp;nbsp;&amp;nbsp; bla,
&amp;nbsp;&amp;nbsp;&amp;nbsp; bla,
&amp;nbsp;&amp;nbsp;&amp;nbsp; bla,
)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:16:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207939#M16007</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T10:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207940#M16008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 15px;"&gt;&lt;A href="https://community.esri.com/migrated-users/48550"&gt;Blake Terhune&lt;/A&gt;​&lt;/P&gt;&lt;P style="font-size: 15px;"&gt;Taking the feature class to shapefile processing organized by utm (sheet) location ( folder: block, subfolder: sheet ) in the case we need to filter the exported output, in other words, create only shapefiles of a specific location (e.g. Block 1: "B1"), what would be the way to accomplish it? That filter-variable would be given as &lt;SPAN style="font-size: 15px;"&gt;input to the script.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2016 17:15:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207940#M16008</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2016-05-05T17:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207941#M16009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Will you only ever filter on block or do you want to also filter on sheet or something else? Will it be a single filter value or a list of filter values?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2016 18:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207941#M16009</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-05-06T18:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting (Python) Feature Class content into Shapefiles based on an UTM data structure</title>
      <link>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207942#M16010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/48550"&gt;Blake Terhune&lt;/A&gt; We could manage a filter on block introducing an &lt;SPAN style="text-decoration: underline;"&gt;if&lt;/SPAN&gt; condition inside&amp;nbsp; the loop&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt; "&lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt; utm &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt; distinct_utm".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;At a block filter level makes sense to use a single value.&lt;/P&gt;&lt;P&gt;Would be interesting contemplating also a filter on sheet. How could we manage this? Thank you &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2016 10:45:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-python-feature-class-content-into/m-p/207942#M16010</guid>
      <dc:creator>EduardoAbreu-Freire</dc:creator>
      <dc:date>2016-05-09T10:45:26Z</dc:date>
    </item>
  </channel>
</rss>

