<?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: List of feature classes with ObjectID in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427191#M33538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See &lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=982&amp;amp;t=241091"&gt;this thread&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your script wouldn't take out any of your feature classes.&amp;nbsp; As I understand it, those ObjectID_n fields are no longer maintained by esri as the object ID, but are maybe left in the feature class in case you were using them for a relate or something?&amp;nbsp; I always use my own ID that I can control when doing relates and joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you can just delete those fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 May 2015 14:33:45 GMT</pubDate>
    <dc:creator>JeffWard</dc:creator>
    <dc:date>2015-05-26T14:33:45Z</dc:date>
    <item>
      <title>List of feature classes with ObjectID</title>
      <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427190#M33537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a geodatabase that contains some stand-alone feature classes, and many feature datasets filled with more feature classes.&lt;/P&gt;&lt;P&gt;The GDB was created long ago without anyone to properly manage it, and there are many feature classes for which the OID field is named ObjectID_1, ObjectID_2, etc. Correcting this is a bridge I'll cross much later.&lt;/P&gt;&lt;P&gt;Each feature class contains a field called "ObjectID", whether it's the true OID field or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to identify all feature classes that have an OID field not called "OBJECTID". The method I was using was to make a list of all feature classes in the GDB, and then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for f in fclist:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(sdeConn + os.sep + f)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foid = desc.OIDFieldName&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if foid == "OBJECTID":&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fclist.remove(f)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should remove all feature classes for which the OID field is named "OBJECTID", correct? Well, it removes some, but not all of those feature classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thoughts and suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 14:23:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427190#M33537</guid>
      <dc:creator>CFrate</dc:creator>
      <dc:date>2015-05-26T14:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: List of feature classes with ObjectID</title>
      <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427191#M33538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See &lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=982&amp;amp;t=241091"&gt;this thread&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your script wouldn't take out any of your feature classes.&amp;nbsp; As I understand it, those ObjectID_n fields are no longer maintained by esri as the object ID, but are maybe left in the feature class in case you were using them for a relate or something?&amp;nbsp; I always use my own ID that I can control when doing relates and joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you can just delete those fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 14:33:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427191#M33538</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2015-05-26T14:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: List of feature classes with ObjectID</title>
      <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427192#M33539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Jeff. Sorry if I wasn't clear.&lt;/P&gt;&lt;P&gt;I'm not treating them as OIDs or trying to join or get rid of them. I'll worry about that at a later date. I just need to identify all feature classes that contain a non-OID field called "OBJECTID".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, feature class &lt;EM&gt;Roads&lt;/EM&gt; may have an OID field called "OBJECTID_2", as well as two non-OID fields called "OBJECTID" and "OBJECTID_1", whereas &lt;EM&gt;Zoning&lt;/EM&gt; may have only the proper "OBJECTID" as its OID field, and no others with an OBJECTID name. My resulting list would contain &lt;EM&gt;Roads&lt;/EM&gt;, but not &lt;EM&gt;Zoning&lt;/EM&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 15:35:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427192#M33539</guid>
      <dc:creator>CFrate</dc:creator>
      <dc:date>2015-05-26T15:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: List of feature classes with ObjectID</title>
      <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427193#M33540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hows about this code: (Not indented properly)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Create an empty list to store the BAD FCs in&lt;/P&gt;&lt;P&gt;BadFCs = []&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;for f in fclist:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(sdeConn + os.sep + f)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foid = desc.OIDFieldName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # If the filed is not the right one&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if foid != "OBJECTID":&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BadFCs.append(f)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Print the outputs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for f in &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;BadFCs:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print (f)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 15:35:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427193#M33540</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2015-05-26T15:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: List of feature classes with ObjectID</title>
      <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427194#M33541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad I helped, I have no idea what was wrong with your code, but it was possibly something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The feature classes:&lt;/P&gt;&lt;P&gt;FC1&lt;/P&gt;&lt;P&gt;FC2&lt;/P&gt;&lt;P&gt;FC3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ok loop throught these FCs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check list[0]:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FC1 - it has Bad field name, remove from loop.&amp;nbsp; (List now looks like) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FC2&lt;/P&gt;&lt;P&gt;FC3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next loop Item - check list [1]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;list[1] = FC3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it skipped FC2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully that makes sense, although I could be wrong!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 16:00:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427194#M33541</guid>
      <dc:creator>LukeWebb</dc:creator>
      <dc:date>2015-05-26T16:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: List of feature classes with ObjectID</title>
      <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427195#M33542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks! Hadn't thought to try the opposite, but that did the trick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 16:05:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427195#M33542</guid>
      <dc:creator>CFrate</dc:creator>
      <dc:date>2015-05-26T16:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: List of feature classes with ObjectID</title>
      <link>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427196#M33543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found why it didn't always work. It was a capitalization issue. Some feature classes have the field "ObjectID" (as opposed to "OBJECTID"), which my script didn't identify.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 16:18:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-of-feature-classes-with-objectid/m-p/427196#M33543</guid>
      <dc:creator>CFrate</dc:creator>
      <dc:date>2015-05-26T16:18:32Z</dc:date>
    </item>
  </channel>
</rss>

