<?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: Adding a default GUID to a layer via ArcPy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/adding-a-default-guid-to-a-layer-via-arcpy/m-p/1006086#M59192</link>
    <description>&lt;P&gt;Perhaps this tech support article will help: &lt;A title="How To: Calculate unique identifier values similar to Global IDs" href="https://support.esri.com/en/technical-article/000011677" target="_self"&gt;How To: Calculate unique identifier values similar to Global IDs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think a field using a GUID can have a default value set.&amp;nbsp;&amp;nbsp; An alternative would be to create/use a text field.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2020 03:36:11 GMT</pubDate>
    <dc:creator>RandyBurton</dc:creator>
    <dc:date>2020-12-02T03:36:11Z</dc:date>
    <item>
      <title>Adding a default GUID to a layer via ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/adding-a-default-guid-to-a-layer-via-arcpy/m-p/1006080#M59190</link>
      <description>&lt;DIV class="usertext-body may-blank-within md-container "&gt;&lt;DIV class="md"&gt;&lt;P&gt;I have a valid GUID string that I need to use as the default value for a field on a particular table - this field acts as a foreign key. According to the documentation for AssignDefaultToField_management, the default value argument must match the data type of the field.&lt;/P&gt;&lt;P&gt;I figured that it would be as simple as casting the string into a GUID, like:&lt;/P&gt;&lt;P&gt;uuid.UUID('ea26af74-8d59-41ce-ab24-965e83825b84')&lt;/P&gt;&lt;P&gt;But doing so results in a generic "Object: Error in executing tool" message. I assume that the problem is that the uuid data type in Python isn't actually the same as what's used by ESRI but I can't find any documentation on what that data type is, much less how to cast a string to it. Anyone have any pointers?&lt;/P&gt;&lt;P&gt;I've also tried adding in brackets around the uuid, formatting it like so:&lt;/P&gt;&lt;P&gt;"{{{}}}".format('ea26af74-8d59-41ce-ab24-965e83825b84')&lt;/P&gt;&lt;P&gt;Neither of these worked.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Dec 2020 02:57:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-a-default-guid-to-a-layer-via-arcpy/m-p/1006080#M59190</guid>
      <dc:creator>AdrianMartinez</dc:creator>
      <dc:date>2020-12-02T02:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a default GUID to a layer via ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/adding-a-default-guid-to-a-layer-via-arcpy/m-p/1006086#M59192</link>
      <description>&lt;P&gt;Perhaps this tech support article will help: &lt;A title="How To: Calculate unique identifier values similar to Global IDs" href="https://support.esri.com/en/technical-article/000011677" target="_self"&gt;How To: Calculate unique identifier values similar to Global IDs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think a field using a GUID can have a default value set.&amp;nbsp;&amp;nbsp; An alternative would be to create/use a text field.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 03:36:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-a-default-guid-to-a-layer-via-arcpy/m-p/1006086#M59192</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-12-02T03:36:11Z</dc:date>
    </item>
  </channel>
</rss>

