<?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 Directly retrieve the stored value for an attribute that uses a domain? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/directly-retrieve-the-stored-value-for-an/m-p/200249#M15390</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Pro (using 2.4.3) when an attribute uses a domain, the Attributes pane provides the ability to display either its stored value or its description (by checking or unchecking 'Show domain and Subtype descriptions').&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to do this through python &lt;SPAN style="text-decoration: underline;"&gt;directly&lt;/SPAN&gt; - i.e. without having to look up the corresponding description in the domain and retrieve the code from there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far I have only been able to output the attributes' description using python - not the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Jul 2020 19:01:05 GMT</pubDate>
    <dc:creator>AngelaDeegan</dc:creator>
    <dc:date>2020-07-31T19:01:05Z</dc:date>
    <item>
      <title>Directly retrieve the stored value for an attribute that uses a domain?</title>
      <link>https://community.esri.com/t5/python-questions/directly-retrieve-the-stored-value-for-an/m-p/200249#M15390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Pro (using 2.4.3) when an attribute uses a domain, the Attributes pane provides the ability to display either its stored value or its description (by checking or unchecking 'Show domain and Subtype descriptions').&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to do this through python &lt;SPAN style="text-decoration: underline;"&gt;directly&lt;/SPAN&gt; - i.e. without having to look up the corresponding description in the domain and retrieve the code from there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far I have only been able to output the attributes' description using python - not the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2020 19:01:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/directly-retrieve-the-stored-value-for-an/m-p/200249#M15390</guid>
      <dc:creator>AngelaDeegan</dc:creator>
      <dc:date>2020-07-31T19:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Directly retrieve the stored value for an attribute that uses a domain?</title>
      <link>https://community.esri.com/t5/python-questions/directly-retrieve-the-stored-value-for-an/m-p/200250#M15391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've never done it directly (not that this is any marker!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd grab the domain of the cursor fields then use the dictionary provided by the .codedValues attribute for each domain in arcpy.da.ListDomains().&amp;nbsp; But that may well be what you are saying you're trying to avoid.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jul 2020 20:17:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/directly-retrieve-the-stored-value-for-an/m-p/200250#M15391</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-07-31T20:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Directly retrieve the stored value for an attribute that uses a domain?</title>
      <link>https://community.esri.com/t5/python-questions/directly-retrieve-the-stored-value-for-an/m-p/200251#M15392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, but yes, that's what I was trying to avoid. However, I have now found that I can do this through the use of cursors as shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for fc in arcpy.ListFeatureClasses('gis.sde.PumpStation', "", 'gis.sde.WaterDistribution'):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;with arcpy.da.SearchCursor(fc,('objectid', 'suction_pressure_system')) as cursor: &lt;EM&gt;#Suction_pressure_system uses a coded domain&lt;/EM&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for row in cursor:&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print('{}\t{}'.format(row[0],row[1]))&lt;BR /&gt;58 AA&lt;BR /&gt;43 AA&lt;BR /&gt;55 AJ&lt;BR /&gt;44 AV&lt;BR /&gt;32 AV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2020 23:59:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/directly-retrieve-the-stored-value-for-an/m-p/200251#M15392</guid>
      <dc:creator>AngelaDeegan</dc:creator>
      <dc:date>2020-08-11T23:59:11Z</dc:date>
    </item>
  </channel>
</rss>

