<?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 How do I use Python to test whether a FeatureClass has GlobalIDs? in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530076#M30053</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have some large SDE databases that we want to start replicating. The feature classes need&amp;nbsp; Global IDs to do this. Some already have them. I want to write a script that will go through every feature class and add a Global IDs, but if a FeatureClass already has one, the script ends. I know I can test a Table for hasGlobalID, but it doesn't work on a FeatureClass. How can I write an IF statement that will test whether a FeatureClass has a GlobalID? Does anyone have a better suggestion?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Oct 2011 13:11:14 GMT</pubDate>
    <dc:creator>GerryReidel</dc:creator>
    <dc:date>2011-10-06T13:11:14Z</dc:date>
    <item>
      <title>How do I use Python to test whether a FeatureClass has GlobalIDs?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530076#M30053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have some large SDE databases that we want to start replicating. The feature classes need&amp;nbsp; Global IDs to do this. Some already have them. I want to write a script that will go through every feature class and add a Global IDs, but if a FeatureClass already has one, the script ends. I know I can test a Table for hasGlobalID, but it doesn't work on a FeatureClass. How can I write an IF statement that will test whether a FeatureClass has a GlobalID? Does anyone have a better suggestion?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 13:11:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530076#M30053</guid>
      <dc:creator>GerryReidel</dc:creator>
      <dc:date>2011-10-06T13:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use Python to test whether a FeatureClass has GlobalIDs?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530077#M30054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ListFields function of ArcPy should return you all fields from a feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ListFields/000v0000001p000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ListFields/000v0000001p000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 21:32:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530077#M30054</guid>
      <dc:creator>RobertHu</dc:creator>
      <dc:date>2011-10-06T21:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use Python to test whether a FeatureClass has GlobalIDs?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530078#M30055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is an example on how to do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\VECTOR.sde"

for fc in arcpy.ListFeatureClasses("*"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for field in arcpy.ListFields(fc, "", "GlobalID"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if field.name == "GlobalID":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc + " contains GlobalIDs"

for fd in arcpy.ListDatasets("*"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in arcpy.ListFeatureClasses("*", "", fd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for field in arcpy.ListFields(fc, "", "GlobalID"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if field.name == "GlobalID":
&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 fc + " contains GlobalIDs"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above code will search all stand-alone feature classes, and feature classes with feature datasets to see if the GlobalID field exists.&amp;nbsp; You will just need to update 'env.workspace' to your SDE connection file.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:04:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530078#M30055</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T23:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use Python to test whether a FeatureClass has GlobalIDs?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530079#M30056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am wanting to do this as well. Your posted solution does not feel very robust to me because it is based only on the name of the field. I was able to add a GlobalID text field to a fgdb feature class. This would be a false positive in your code. I looked over the field properties for a better solution, but I don't see one. It would be nice to have a function that returns a boolean--something like: hasGlobalID(table/feature class) = True/False.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="456970" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/456970_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We want to add global ids to all ersi objects in our database but some have existing global ids.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 23:00:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530079#M30056</guid>
      <dc:creator>forestknutsen1</dc:creator>
      <dc:date>2019-08-13T23:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use Python to test whether a FeatureClass has GlobalIDs?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530080#M30057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is just a function, or really a property:&amp;nbsp; &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/gdb-table-properties.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/gdb-table-properties.htm"&gt;GDB Table properties—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;H2 style="font-weight: 300; font-style: normal; margin: -145px 0px 1.55rem; font-size: 1.9994rem; line-height: 2.325rem; padding-top: 175px; color: #4c4c4c; font-family: 'Avenir Next W01', 'Avenir Next W00', 'Avenir Next', Avenir, 'Helvetica Neue', sans-serif; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;Properties&lt;/H2&gt;&lt;TABLE style="margin-bottom: 1.55rem; width: 747.333px; background-color: #ffffff; border-collapse: collapse; border-spacing: 0px; border: 1px solid #cccccc; text-align: left; overflow: auto; font-size: 0.875rem; line-height: 1.55rem; color: #4c4c4c; font-family: 'Avenir Next W01', 'Avenir Next W00', 'Avenir Next', Avenir, 'Helvetica Neue', sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;&lt;THEAD style="background-color: #efefef; border-bottom: 1px solid #cccccc; font-weight: 400; font-style: normal; font-size: 1rem; line-height: 1.55rem;"&gt;&lt;TR style="border-bottom: none; text-align: left;"&gt;&lt;TD class="" style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;Property&lt;/TD&gt;&lt;TD class="" style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;Explanation&lt;/TD&gt;&lt;TD class="" style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;Data Type&lt;/TD&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY style="overflow: auto; width: 747.333px;"&gt;&lt;TR style="border-bottom: 1px solid #cccccc; text-align: left;"&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;globalIDFieldName&lt;DIV class=""&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;&lt;P style="margin-top: 0px; margin-bottom: 0px;"&gt;The name of the GlobalID field.&lt;/P&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;String&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border-bottom: 1px solid #cccccc; text-align: left;"&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;hasGlobalID&lt;DIV class=""&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;&lt;P style="margin-top: 0px; margin-bottom: 0px;"&gt;Indicates whether the table has a GlobalID field.&lt;/P&gt;&lt;/TD&gt;&lt;TD style="font-weight: 300; border-left: 1px solid #cccccc; border-right: 1px solid #cccccc; padding: 0.51667rem;"&gt;Boolean&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2019 03:52:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530080#M30057</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2019-08-14T03:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use Python to test whether a FeatureClass has GlobalIDs?</title>
      <link>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530081#M30058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joshua!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2019 18:00:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/how-do-i-use-python-to-test-whether-a-featureclass/m-p/530081#M30058</guid>
      <dc:creator>forestknutsen1</dc:creator>
      <dc:date>2019-08-14T18:00:54Z</dc:date>
    </item>
  </channel>
</rss>

