<?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: Accessing Coded Domain Values using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18103#M1434</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just adding this here because this was the top hit in Google for my first search on the same topic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/environment-settings/transfergdbattributeproperties.htm"&gt;https://pro.arcgis.com/en/pro-app/tool-reference/environment-settings/transfergdbattributeproperties.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can leverage environment settings to do this now instead of the dictionary repeat&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Apr 2019 23:53:23 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2019-04-25T23:53:23Z</dc:date>
    <item>
      <title>Accessing Coded Domain Values using python</title>
      <link>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18100#M1431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to find a way to access domain codes and descriptive values using python for each record in a given field. I have a domain code set for a few fields in a feature class. The user will populate the records for each field using the coded values I set. When that is done, I want to access the value they chose in the attribute table using python. I tried the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for row in arcpy.SearchCursor("TESTFC") &amp;nbsp;&amp;nbsp;&amp;nbsp; print row.TestField1&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This returns the coded value if a record was populated by the domain code and it prints out 'None' if the record is Null. I'm wondering if you can return the descriptive value for the domain code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2012 18:12:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18100#M1431</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2012-04-11T18:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain Values using python</title>
      <link>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18101#M1432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The following code should help. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I put in an excessive amount of comments to make this clear as I don't know your skill level with Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy&amp;nbsp; #Create a table in memory to hold the codes and their descriptions for a particular domain. cvdTable = arcpy.DomainToTable_management(r'C:\vancouver.gdb', 'type', 'in_memory/cvdTable', 'codeField', 'descriptionField')&amp;nbsp; #Create an empty dictionary. d = {}&amp;nbsp; #Create a cursor to loop through the table holding the domain and code info rows = arcpy.SearchCursor(cvdTable)&amp;nbsp; # Loop through each row in the table. for row in rows: &amp;nbsp; # For each row in the table populate the key with the code field and the value from the description field &amp;nbsp; d[row.codeField] = row.descriptionField #Cleanup del row del rows&amp;nbsp; # Create a search cursor on the table with the domain rows2 = arcpy.SearchCursor(r'C:\vancouver.gdb\TESTFC') # Loop through the records in the table. for row2 in rows2: &amp;nbsp; # Print the dictionary value for each code that is returned from this search cursor &amp;nbsp; print d[row2.PipeType] #Cleanup del row del rows &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 19:06:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18101#M1432</guid>
      <dc:creator>RussellBrennan</dc:creator>
      <dc:date>2012-04-12T19:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain Values using python</title>
      <link>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18102#M1433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Russell, thanks for the post!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I actually forgot about this post, but started working on a solution. I came across the domain to table tool and I wrote a script and it works very well. It's similar to what you posted. In my case, I just generated the tool into a scratchworkspace, read from it while my tool processes and then deleted it. The domain tools have fixed a lot of my issues!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 18:16:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18102#M1433</guid>
      <dc:creator>MikeMacRae</dc:creator>
      <dc:date>2012-04-20T18:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain Values using python</title>
      <link>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18103#M1434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just adding this here because this was the top hit in Google for my first search on the same topic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/environment-settings/transfergdbattributeproperties.htm"&gt;https://pro.arcgis.com/en/pro-app/tool-reference/environment-settings/transfergdbattributeproperties.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can leverage environment settings to do this now instead of the dictionary repeat&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2019 23:53:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/accessing-coded-domain-values-using-python/m-p/18103#M1434</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-25T23:53:23Z</dc:date>
    </item>
  </channel>
</rss>

