<?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: Select by attribute use cursor save off as feature class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79406#M6405</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, I appreciate it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is one last thing that has come up. There is one, where EXTENSION = &amp;lt;Null&amp;gt;. Everything works but it is still naming the feature class "RSID"+num+ext where ext is None (ex. RSID783None). There is a catch for it but it doesn't seem to be blanking it out. My guess is it isn't understanding the &amp;lt;Null&amp;gt;. I would like it to look like this, RSID783. Any thoughts?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Feb 2014 17:10:29 GMT</pubDate>
    <dc:creator>MikePowell</dc:creator>
    <dc:date>2014-02-19T17:10:29Z</dc:date>
    <item>
      <title>Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79398#M6397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I feel this is a very basic problem but for the life of me I can't seem to figure out what is wrong, which is driving mad. I am assuming it is my logic. I have a feature class with hundreds of polygons. I figured I could make a layer file, use a search cursor to select each polygon and save each one off as it's own feature class. I seem to always get an error that the dataset xxxxx does not exist or is not supported when trying to do Copy Feature.&amp;nbsp; Here is what I have:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import sys, string, os, cx_Oracle, arcpy, datetime

arcpy.env.workspace = "c:\\work\\scripting\\test\\testdata.gdb"
arcpy.MakeFeatureLayer_management("rsids","rsid_view")
rows = arcpy.SearchCursor("rsid_view","","","NUM; EXTENSION","NUM A")
row = rows.next()
while row:
&amp;nbsp;&amp;nbsp;&amp;nbsp; RSIDNum = str(row.getValue("NUM"))
&amp;nbsp;&amp;nbsp;&amp;nbsp; Ext = str(row.getValue("EXTENSION"))
&amp;nbsp;&amp;nbsp;&amp;nbsp; if Ext == "None":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ext = ""
&amp;nbsp;&amp;nbsp;&amp;nbsp; rsid = RSIDNum+Ext
&amp;nbsp;&amp;nbsp;&amp;nbsp; RSID = "RSID"+RSIDNum+Ext
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(RSID, "c:\\work\\scripting\\test\\testdata.gdb\\"+RSID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; row - rows.next()
del row
del rows
if arcpy.Exists("rsid_view"):
&amp;nbsp;&amp;nbsp; arcpy.Delete_management("rsid_view")
&amp;nbsp;&amp;nbsp; print "View deleted"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried using Select by attribute first (before the search cursor) but that almost seems redundant, and I get the same problem anyway. Any help will be appreciated. Thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Feb 2014 18:39:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79398#M6397</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2014-02-18T18:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79399#M6398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Mike,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A few notes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;First off, you have change the &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;row - rows.next()&lt;/SPAN&gt; to &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;row = rows.next()&lt;/SPAN&gt; (in the while loop).&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Second, check your field name &lt;SPAN style="font-style:italic;"&gt;"NUM A"&lt;/SPAN&gt; can't be a field name since it has a space.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Third, I would actually change the while loop to a for loop (and get rid of both &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;row = rows.next()&lt;/SPAN&gt; lines). This would negate the first comment. I find for loops generally easier to grasp and less problematic.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Forth, I would use the &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001200000020000000" rel="nofollow noopener noreferrer" target="_blank"&gt;Feature Class To Feature Class tool&lt;/A&gt;. It has a built in where clause that would allow you to only export one record at a time.&lt;/LI&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;BR /&gt;&lt;SPAN&gt;I would use something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
arcpy.env.workspace = "C:\\work\\scripting\\test\\testdata.gdb"
fc="rsid"
outLocation="C:\\work\\scripting\\test\\output"
rows = arcpy.SearchCursor(fc,"","","NUM; EXTENSION","NUM A")
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; where='"FID" = '+str(row.NUM) #Note that the given field must be unique, also assumes field is a number type. We'll have to make a new where statement if NUM is a string/text
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, str(row.NUM), where)
del row
del rows
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know how it goes, we'll figure it out!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:03:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79399#M6398</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-10T23:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79400#M6399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the quick reply. I will just go off your steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Yep, that was a type-o. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. NUM A is not field name. It is an attribute of the SearchCursor where I am sorting on the field name NUM. NUM and EXTENSION are the two field names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. I have tried the "for loop" as well. with no success.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. I like the use of the Feature Class to Feature Class. I tried that once but I couldn't get it to work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran what you provided, this is what I got:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 000361: The name starts with an invalid character&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (FeatureClassToFeatureClass).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know that NUM is set up as a string but they are all numbers and isn't that an issue when naming a feature class. That is why I had that other code in there to merge the field names and add "RSID" in front of it. I went ahead and tried this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, "r"+str(row.NUM), where)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;that seemed to work until it got to a duplicate. That is why I have a Select by Layer to eliminate those duplicates:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.SelectLayerByAttribute_management("rsid_view", "NEW_SELECTION", """"EXTENSION" not like 'X%' AND "EXTENSION" &amp;lt;&amp;gt; 'x'""")
arcpy.SelectLayerByAttribute_management("rsid_view", "ADD_TO_SELECTION", """"NUM" = '783'""")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess I just answered my own thoughts about it being redundant with the SearchCursor. Any thoughts? Can you use FeatureClassToFeatureClass with a MakeFeatureLayer? I also noticed that the feature classes that it did make, were named correctly but the attributes were not correct on any of them and some didn't have any. Appreciate any other thoughts you might have. Thanks again in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:03:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79400#M6399</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2021-12-10T23:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79401#M6400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Mike,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding item 2: my apologies, you're right. Also, nice fix on the error!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding the where clause:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;NUM&lt;/SPAN&gt;&lt;SPAN&gt; is actually set up as a string, you'll need to change the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;where&lt;/SPAN&gt;&lt;SPAN&gt; expression to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;where='"NUM" = \''+str(row.NUM)+'\''&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I guess if you got it working then you should leave it as is!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regarding the duplicate issue, it depends on how you want to handle them. I assume you sorted the records and you only want to take the first unique record.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assuming your dataset isn't absurdly large, I would create an array of all &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;NUM&lt;/SPAN&gt;&lt;SPAN&gt;'s you've processed and then only create a new FC if the current &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;NUM&lt;/SPAN&gt;&lt;SPAN&gt; isn't in the processed &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;NUM&lt;/SPAN&gt;&lt;SPAN&gt; array. Like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
arcpy.env.workspace = "C:\\work\\scripting\\test\\testdata.gdb"
fc="rsid"
outLocation="C:\\work\\scripting\\test\\output"
rows = arcpy.SearchCursor(fc,"","","NUM; EXTENSION","NUM A")
processedNUMs=[]
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; num=str(row.NUM)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if num in processedNUMs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue
&amp;nbsp;&amp;nbsp;&amp;nbsp; where='"NUM" = '+num #if NUM is a number
&amp;nbsp;&amp;nbsp;&amp;nbsp; #where='"NUM" = \''+num+'\'' #if NUM is a string/text
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.EXTENSION == "None":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext=""
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext=str(row.EXTENSION)
&amp;nbsp;&amp;nbsp;&amp;nbsp; newFCName="RSID"+num+ext
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, newFCName, where)
&amp;nbsp;&amp;nbsp;&amp;nbsp; processedNUMs.append(num)
del row
del rows
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:03:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79401#M6400</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-10T23:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79402#M6401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nice! here is the final code that worked:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.workspace = "C:\\work\\scripting\\test\\testdata.gdb"
fc="rsids"
outLocation="C:\\work\\scripting\\test\\results.gdb"
rows = arcpy.SearchCursor(fc,"","","NUM; EXTENSION","NUM A")
processedNUMs=[]
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; num=str(row.NUM)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if num in processedNUMs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue
&amp;nbsp;&amp;nbsp;&amp;nbsp; #where='"NUM" = '+num #if NUM is a number
&amp;nbsp;&amp;nbsp;&amp;nbsp; where='"NUM" = \''+num+'\'' #if NUM is a string/text
&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.EXTENSION == "None":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext=""
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext=str(row.EXTENSION)
&amp;nbsp;&amp;nbsp;&amp;nbsp; newFCName="RSID"+num+ext
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, newFCName, where)
&amp;nbsp;&amp;nbsp;&amp;nbsp; processedNUMs.append(num)
del row
del rows&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had to make a couple of minor changes but it worked. I wasn't thinking array. Dictionary came up but wasn't sure about that. The only problem now, which I just found out after running this, is that in the attribute table, it isn't consist in the order how things were put in. If you notice in my Select Layer by Attributes, I was eliminating those with the EXTENSION = X (because those are duplicates of another with the same NUM but different EXTENSION but I don't want the ones with EXTENSION = X). After running your script, I found that some of those were ahead of the ones I wanted so it was doing those instead of the ones I wanted. Thank you so much for the help. If you have any ideas of having them skip the ones with EXTENSION = X that would be great. I will be working on that as well. I am thinking some kind of "if" statement running through the array? I'm just happy that it is working. Thanks again&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:03:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79402#M6401</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2021-12-10T23:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79403#M6402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Mike,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm happy to hear we're on the right track. As I understand it (please correct me if I'm wrong), you want to skip over any records that has an extension starting with the character 'x', or if the extension is simple 'x'. I'll also assume you want to skip the record regardless of case ('x' vs 'X').&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is all correct, add these lines (just before the line &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;newFCName="RSID"+num+ext&lt;/SPAN&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
if ext.lower().startswith('x'):
&amp;nbsp;&amp;nbsp;&amp;nbsp; continue
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Note this will also skip records if the extension is simple 'x' or 'X'. If you want to be case sensitive, remove &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;.lower()&lt;/SPAN&gt;&lt;SPAN&gt; and change 'x' to 'X' if desired.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know how it goes!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:03:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79403#M6402</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-10T23:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79404#M6403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That was the ticket. Thanks for all the help. There is a lot more to this script that I am working on, but I will be able to incorporate this into it and get that much closer to finishing it. It is possible that I will be on the forum again soon but I try to use it as a last resort and try to figure it out first on my own. I feel I understand more than the basics but I have a problem putting it all together in script form. I can read scripts a lot better than I can write them. Thanks again&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 14:17:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79404#M6403</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2014-02-19T14:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79405#M6404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good. I'm happy we fixed this part of your script. Your coding looks pretty good, you just need to keep learning the small tricks. I hope you get your master script working, but i'll keep an eye out (on this thread or a new one) in case you hit any brick walls.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck, have fun!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 14:39:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79405#M6404</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-19T14:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79406#M6405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, I appreciate it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is one last thing that has come up. There is one, where EXTENSION = &amp;lt;Null&amp;gt;. Everything works but it is still naming the feature class "RSID"+num+ext where ext is None (ex. RSID783None). There is a catch for it but it doesn't seem to be blanking it out. My guess is it isn't understanding the &amp;lt;Null&amp;gt;. I would like it to look like this, RSID783. Any thoughts?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 17:10:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79406#M6405</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2014-02-19T17:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79407#M6406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In python null values are stored as &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;None&lt;/SPAN&gt;&lt;SPAN&gt; (which is different form a string set to "None"). None is a keyword in python. You can type &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;x=None&lt;/SPAN&gt;&lt;SPAN&gt; into python. When you convert None to a string (&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;str(None)&lt;/SPAN&gt;&lt;SPAN&gt;) it prints "None" which is kind of confusing. If it printed an empty string ("") it might be more accurate.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Change this line &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;if row.EXTENSION == "None":&lt;/SPAN&gt;&lt;SPAN&gt; to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;if row.EXTENSION == "None" or row.EXTENSION==None:&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would also work, but it's kind of confusing, so I would not use it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;if str(row.EXTENSION) == "None":&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if it gives you any problems.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 18:07:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79407#M6406</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-19T18:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79408#M6407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Again thanks. That worked great. I tried a couple of different ways to make it blank but I never thought to not have quotes around None. Thanks for all the insight. The rest of the script is coming together great. Just cleaning up little things to make it all tie together. There will be one more section that I will have to write that will probably rack my brains a little but hopefully, I will be able to figure it out. If not, I will back on here. Thanks again&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 19:14:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79408#M6407</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2014-02-19T19:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79409#M6408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua, I was wondering if you were still out there. I am having a problem with the above script again (I know 2 yrs later). The FeatureClassTo FeatureClass is not working. I get the dreaded ERROR 9999999. I can't figure out why. Some stuff has changed in the database that I would think make thing easier but I just can't seem to get it past that point. If you are available for a little bit I was hoping to ask for a little help, since you were the one that was so kind to helped me before. If you can help I will fill you in on what has changed in the database and what I thought would work. Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 22:39:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79409#M6408</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2016-05-11T22:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79410#M6409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike... I sent Josh a message, hopefully you will hear from him.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 22:44:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79410#M6409</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-11T22:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79411#M6410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I really appreciate it. I hope it’s not much of a problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 May 2016 22:47:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79411#M6410</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2016-05-11T22:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79412#M6411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mike,&lt;/P&gt;&lt;P&gt;I'm still kicking around. Feel free to ask away! &lt;/P&gt;&lt;P&gt;I'll see if I can help (and it looks like we may get help from guru &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;​)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2016 14:03:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79412#M6411</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2016-05-12T14:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79413#M6412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Again, thanks in advance for any help, and time. I hope this isn’t too hard to read. Basically, I am trying to do the same thing as before. I have a feature class (RSID)with a few hundred features. I would like to select each on and make it its own feature class and do stuff to it. So, I have everything done that I need to do to each RSID but I can’t seem to get the FeatureClassToFeatureClass to work. Now before, when we worked on it, there was a column NUM and an EXTENSION column that I needed and that is how we did what we did before. Now there is a NAME column that has what I need (both name and extension and when I dissolve on NAME I figure I don’t need a lot of what we had in there before. I thought that I could just search cursor through the NAME column, add “RSID” to the front of the name as I know that a feature class can’t start with a number (the NAME column looks like this ex. 789M, 801M, 541L) and make the name feature class. I am getting the ERROR 999999. I have what I did down below, and I have commented out the old code that we were using. To explain the script, I am making sure that that I have copies of feature classes and dissolving on NAME. I am than setting up some directories and feature datasets to put everything and making sure everything is correct with the slashes, than I do the searchcursor. It all works until it gets to the FeatureClassToFeatureClass. Any thoughts? I guess I haven't figured out how to copy and paste the script. The first attempt was pretty bad. The second was better but I decided just to attach it. Let me know if it doesn't work&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2016 15:01:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79413#M6412</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2016-05-12T15:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79414#M6413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Mike, Thanks for the clear post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nice looking script, I have a few suggestions of the get-go.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;the line &lt;EM&gt;&lt;STRONG&gt;arcpy.FeatureClassToFeatureClass_conversion(nfc, NewoutLocation,&lt;/STRONG&gt;&lt;/EM&gt;&lt;STRONG&gt; newFCName)&lt;/STRONG&gt; has no where clause (the optional 4th parameter). I think this means that even if the line weren't erroring out, it would create a full copy of every row in the "nfc" feature class X times (where X is the number of rows in the "nfc" feature class).&lt;BR /&gt;I think you will want to add a where clause so it only exports the current row each time. Something like this might work:&lt;PRE __default_attr="python" __jive_macro_name="code" class="_jivemacro_uid_14630680524549305 jive_macro_code jive_text_macro" data-renderedposition="167_38_1302_16" jivemacro_uid="_14630680524549305" modifiedtitle="true"&gt;arcpy.FeatureClassToFeatureClass_conversion(nfc, NewoutLocation, newFCName, "NAME = '"+row.NAME+"'")&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;In addition to the query, you might want to try exporting to the GDB, not the Dataset within the GDB. I've run into problems before when exporting to a Dataset. Sometimes inconsistent projections or precisions can cause problems. Try outputting to "outLocation" for now, and exporting to a Dataset once we have everything else working. Your new line (including item 1 above, should look something like this: &lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14630683309303447 jive_text_macro" data-renderedposition="264_38_1302_16" jivemacro_uid="_14630683309303447"&gt;arcpy.FeatureClassToFeatureClass_conversion(nfc, outLocation, newFCName, "NAME = '"+row.NAME+"'")&lt;/PRE&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if those 2 changes do anything. Also,any chance you can post a small data set for testing?&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2016 15:55:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79414#M6413</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2016-05-12T15:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select by attribute use cursor save off as feature class</title>
      <link>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79415#M6414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cool, that seemed to work. I was under the impression that the where clause was optional and that you didn’t have to have it as a parameter. This is working now. It is bombing at another point in the script where it is doing other things but is using FeatureClassToFeatureClass_conversion without a where clause. I will have to look into that a little more to determine the where clause that I am going to need. I just haven’t reached that point before now. Thanks again for the help. I am glad to know that my thinking was correct in that I didn’t need all that other code now, but it makes me wonder why I didn’t dissolve it in the first place. Oh well, live and learn. I will keep in mind the Dataset issue as well. I will let you know if something else comes up. Again, appreciate the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2016 17:53:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-by-attribute-use-cursor-save-off-as-feature/m-p/79415#M6414</guid>
      <dc:creator>MikePowell</dc:creator>
      <dc:date>2016-05-12T17:53:16Z</dc:date>
    </item>
  </channel>
</rss>

