<?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 Script Adding Numbers to End of Domains? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-adding-numbers-to-end-of-domains/m-p/71628#M5895</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello again!&amp;nbsp; Until I find a way to return a list of subtype field's domains, I have used this workaround:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Import feature class into a fresh file geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Set the default subtype field to "Interstate"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Run the script to return the field domains with an "Interstate" subtype&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Set the default subtype field to "State Route"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5) Run the script to return the field domains with an "Interstate" subtype&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;repeat, repeat...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Oddly, the output includes the addition of an underscore and a number after some, but not all of the results (see attached).&amp;nbsp; What could be causing this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#Set workspace environment to geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = r"\\Gissrv1\017gisdatt\017GISDATA\Geodatabases\NDOT_Transportation.gdb"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Get list of feature classes in geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FCs = arcpy.ListFeatureClasses()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through feature classes in list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for FC in FCs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#List fields in feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fields = arcpy.ListFields(FC)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for field in fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Check if field has domain&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if field.domain != "":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Print feature class, field, domain name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print FC, ",", field.name, ",", field.domain&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Get list of feature datasets in geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FDs = arcpy.ListDatasets("*", "Feature")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through feature datasets in list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for FD in FDs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#List fields in feature dataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fields = arcpy.ListFields(FD)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for field in fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Check if field has domain&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if field.domain != "":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Print feature class, field, domain name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print FD, ",", field.name, ",", field.domain&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Feb 2012 20:52:44 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2012-02-27T20:52:44Z</dc:date>
    <item>
      <title>Script Adding Numbers to End of Domains?</title>
      <link>https://community.esri.com/t5/python-questions/script-adding-numbers-to-end-of-domains/m-p/71628#M5895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello again!&amp;nbsp; Until I find a way to return a list of subtype field's domains, I have used this workaround:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Import feature class into a fresh file geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Set the default subtype field to "Interstate"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Run the script to return the field domains with an "Interstate" subtype&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4) Set the default subtype field to "State Route"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5) Run the script to return the field domains with an "Interstate" subtype&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;repeat, repeat...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Oddly, the output includes the addition of an underscore and a number after some, but not all of the results (see attached).&amp;nbsp; What could be causing this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#Set workspace environment to geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = r"\\Gissrv1\017gisdatt\017GISDATA\Geodatabases\NDOT_Transportation.gdb"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Get list of feature classes in geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FCs = arcpy.ListFeatureClasses()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through feature classes in list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for FC in FCs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#List fields in feature class&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fields = arcpy.ListFields(FC)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for field in fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Check if field has domain&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if field.domain != "":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Print feature class, field, domain name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print FC, ",", field.name, ",", field.domain&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Get list of feature datasets in geodatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FDs = arcpy.ListDatasets("*", "Feature")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through feature datasets in list&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for FD in FDs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#List fields in feature dataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fields = arcpy.ListFields(FD)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Loop through fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for field in fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Check if field has domain&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if field.domain != "":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Print feature class, field, domain name&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print FD, ",", field.name, ",", field.domain&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2012 20:52:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-adding-numbers-to-end-of-domains/m-p/71628#M5895</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-02-27T20:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Script Adding Numbers to End of Domains?</title>
      <link>https://community.esri.com/t5/python-questions/script-adding-numbers-to-end-of-domains/m-p/71629#M5896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The above script only reads the domains. The domains with underscore numbers seem to be duplicates, which would indicate that there is a problem in how you're writing the domains.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ps - it's much easier to read your code if you wrap them in the provided &lt;PRE&gt; tags, above the post text box.&lt;/PRE&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2012 21:10:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-adding-numbers-to-end-of-domains/m-p/71629#M5896</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2012-02-27T21:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script Adding Numbers to End of Domains?</title>
      <link>https://community.esri.com/t5/python-questions/script-adding-numbers-to-end-of-domains/m-p/71630#M5897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your response!&amp;nbsp; I thought the same thing, so I went into the database and examined the domains.&amp;nbsp; I can't find any evidence that the ones I marked in red exist.&amp;nbsp; There aren't any duplicate domains.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2012 21:13:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-adding-numbers-to-end-of-domains/m-p/71630#M5897</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-02-27T21:13:55Z</dc:date>
    </item>
  </channel>
</rss>

