<?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: Extracting from attribute tables by arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313429#M24362</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, this is one of the tools which I had used to solve the problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for taking part in this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Apr 2015 07:45:21 GMT</pubDate>
    <dc:creator>deleted-user-3rTxRfVTcNm-</dc:creator>
    <dc:date>2015-04-28T07:45:21Z</dc:date>
    <item>
      <title>Extracting from attribute tables by arcpy</title>
      <link>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313424#M24357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having some trouble connecting ideas on how to solve a problem. What I have is a shapefile from which I have to extract from one field, which contains 3 types of attributes (BS, RS, BRN). For each of those attributes, I've created a geodatabase and separate feature classes using another script.&lt;/P&gt;&lt;P&gt;I short, attributes have to go to their specific designation e.g. BS values go to feature BS, RS values etc.&lt;/P&gt;&lt;P&gt;My first guess is that I have to use Cursors to do it, but in this case I have to use both Search and Insert and how would I do that? &lt;/P&gt;&lt;P&gt;Would it make sense a start such as this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

shape = "D:/M1 Geomatique/Programmation II/Dossier/ZONE_INONDATION_SYNTHESE_67.shp"
gdb = "D:/M1 Geomatique/Programmation II/Dossier/inondation.gdb"
field = "CODE_DEGRE"
entite1 = "rs"
entite2 = "bs"
entite3 = "brn"

rows = arcpy.InsertCursor(gdb)
cursor = arcpy.SearchCursor(shape)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perform a loop start with a SearchCursor followed by an InsertCursor could be a solution ? : &lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="kwd"&gt;with&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;da&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;SearchCursor&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;sourceFC&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;fieldnames&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; sCur&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; 

&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;da&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;InsertCursor&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;targetFC&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;fieldnames&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; iCur&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;Above is just an example I've picked up on stackexchange&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would you advise me to tackle this problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:56:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313424#M24357</guid>
      <dc:creator>deleted-user-3rTxRfVTcNm-</dc:creator>
      <dc:date>2021-12-11T14:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from attribute tables by arcpy</title>
      <link>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313425#M24358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From what you said, I believe you are overthinking this too much.&amp;nbsp; You have a shapefile with a certain field in it with 3 different values.&amp;nbsp; You want to make a new feature class for each based on the field value, either "rs", "bs" or "brn".&amp;nbsp; Why not do a select by attribute for each one of those values, then make a feature layer then convert the feature layer to a feature class?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 14:28:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313425#M24358</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-04-27T14:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from attribute tables by arcpy</title>
      <link>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313426#M24359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or you could make a feature layer with a definition query&amp;nbsp; FIELD1 = 'BS' etc. and export those features to a separate feature class.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 14:58:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313426#M24359</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-04-27T14:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from attribute tables by arcpy</title>
      <link>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313427#M24360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-feature-layer.htm"&gt;Make Feature Layer tool reference&lt;/A&gt; -&amp;nbsp; Use the Where Clause parameter to restrict the features you want exported to the various layers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 15:04:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313427#M24360</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-04-27T15:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from attribute tables by arcpy</title>
      <link>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313428#M24361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Ian Murray wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what you said, I believe you are overthinking this too much.&amp;nbsp; You have a shapefile with a certain field in it with 3 different values.&amp;nbsp; You want to make a new feature class for each based on the field value, either "rs", "bs" or "brn".&amp;nbsp; Why not do a select by attribute for each one of those values, then make a feature layer then convert the feature layer to a feature class?&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed, I was overthinking it. There goes my tendency of forgetting that ArcPy module already has plenty of functions and classes to relieve from making countless of procedures, loops, classes all by yourself.&lt;/P&gt;&lt;P&gt;Eventually, I solved the problem last evening by using MakeFeatureLayer tool, SelectLayerByAttribute and CopyFeatures, and it worked perfectly for all three of them. Everything got automatized in a single script, including the creation of a geodatabase to which these new features will go to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyhow, thank you for taking your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 07:44:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313428#M24361</guid>
      <dc:creator>deleted-user-3rTxRfVTcNm-</dc:creator>
      <dc:date>2015-04-28T07:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting from attribute tables by arcpy</title>
      <link>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313429#M24362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, this is one of the tools which I had used to solve the problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for taking part in this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 07:45:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/extracting-from-attribute-tables-by-arcpy/m-p/313429#M24362</guid>
      <dc:creator>deleted-user-3rTxRfVTcNm-</dc:creator>
      <dc:date>2015-04-28T07:45:21Z</dc:date>
    </item>
  </channel>
</rss>

