<?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 List in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1164431#M8033</link>
    <description>&lt;P&gt;Hi Jimmy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can get a list of the domains in a geodatabase with the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic15002.html" target="_self"&gt;Geodatabase.GetDomains&lt;/A&gt; method. This returns an IReadOnlyList which you can search using a Linq query.&lt;/P&gt;&lt;PRE&gt;IReadOnlyList&amp;lt;Domain&amp;gt; domains = myGeodatabase.GetDomains();&lt;BR /&gt;Domain myDomain = domains.First(x =&amp;gt; x.GetName() == myDomainName);&lt;/PRE&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;</description>
    <pubDate>Thu, 14 Apr 2022 15:20:10 GMT</pubDate>
    <dc:creator>RichRuh</dc:creator>
    <dc:date>2022-04-14T15:20:10Z</dc:date>
    <item>
      <title>Accessing Coded Domain List</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1164195#M8030</link>
      <description>&lt;P&gt;I'm looking for a way to get a coded domain list based on it's name so that I can use on as combo box items in a custom dockpane or control.&amp;nbsp; Am I missing the easy way to do this? There doesn't seem to be a way to do this from a workspace. There is a sample that shows how to query them directly from gdb_items in the database.&amp;nbsp; I've also been able to access them through a feature but that isn't a very direct method.&amp;nbsp; I'm currently hard coding the values and descriptions as shown in the image.&amp;nbsp; I would rather not do that for obvious reasons.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JimmyBowden_0-1649891213013.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/38859i7BF3C4C11043B9B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JimmyBowden_0-1649891213013.png" alt="JimmyBowden_0-1649891213013.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 23:08:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1164195#M8030</guid>
      <dc:creator>JimmyBowden</dc:creator>
      <dc:date>2022-04-13T23:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain List</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1164431#M8033</link>
      <description>&lt;P&gt;Hi Jimmy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can get a list of the domains in a geodatabase with the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic15002.html" target="_self"&gt;Geodatabase.GetDomains&lt;/A&gt; method. This returns an IReadOnlyList which you can search using a Linq query.&lt;/P&gt;&lt;PRE&gt;IReadOnlyList&amp;lt;Domain&amp;gt; domains = myGeodatabase.GetDomains();&lt;BR /&gt;Domain myDomain = domains.First(x =&amp;gt; x.GetName() == myDomainName);&lt;/PRE&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 15:20:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1164431#M8033</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2022-04-14T15:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain List</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1164436#M8034</link>
      <description>&lt;P&gt;Wow I'm feeling very dense at the moment.&amp;nbsp; I thought I looked on the geodatabase object, I guess I just missed it.&amp;nbsp; Thanks for the prompt response&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/114916"&gt;@RichRuh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 15:30:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1164436#M8034</guid>
      <dc:creator>JimmyBowden</dc:creator>
      <dc:date>2022-04-14T15:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain List</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1165866#M8045</link>
      <description>&lt;P&gt;In case someone stumbles on this post and needs a bit more here's an extension method to return the values of an Integer based coded value domain from a geodatabase as a dictionary.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;  public static Dictionary&amp;lt;int, string&amp;gt; GetDomainValuesInt(this Geodatabase geodatabase, string name)
        {
            Dictionary&amp;lt;int, string&amp;gt; retval = new Dictionary&amp;lt;int, string&amp;gt;();
            IReadOnlyList&amp;lt;Domain&amp;gt; domains = geodatabase.GetDomains();
            Domain namedomain = domains.FirstOrDefault(a =&amp;gt; a.GetName().Equals(name, StringComparison.CurrentCultureIgnoreCase));
            if (namedomain != null &amp;amp;&amp;amp; namedomain is CodedValueDomain)
            {
                //need to cast the domain to CodedValueDomain to get the Value Pairs
                CodedValueDomain cvd = namedomain as CodedValueDomain;
                SortedList&amp;lt;object, string&amp;gt; valuePairs = cvd.GetCodedValuePairs();
                foreach (var item in valuePairs)
                {
                    if (int.TryParse(item.Key.ToString(), out int i))
                    {
                        retval.Add(i, item.Value);
                    }
                }
            }
            return retval;
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 20:15:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1165866#M8045</guid>
      <dc:creator>JimmyBowden</dc:creator>
      <dc:date>2022-04-19T20:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain List</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1176832#M8183</link>
      <description>&lt;P&gt;Hi Rich,&lt;/P&gt;&lt;P&gt;How can the domains be accessed if the layers are loaded from a feature server and do not exist in a geodatabase? I searched the SDK guide &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;but could not find any method that can do this.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 14:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1176832#M8183</guid>
      <dc:creator>KarthikAditya</dc:creator>
      <dc:date>2022-05-24T14:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain List</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1176941#M8190</link>
      <description>&lt;P&gt;Hi Karthik,&lt;/P&gt;&lt;P&gt;You can create a Geodatabase object from a feature service by creating a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic7642.html" target="_self"&gt;ServiceConnectionProperties&lt;/A&gt; object. &amp;nbsp;You can then instantiate a Geodatabase using the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/#topic15000.html" target="_self"&gt;Geodatabase(ServiceConnectionProperties) constructor&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Once you have a Geodatabase you can proceed as described above.&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 17:39:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1176941#M8190</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2022-05-24T17:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Coded Domain List</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1177096#M8191</link>
      <description>&lt;P&gt;Thank you, Rich. That worked!&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 05:32:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/accessing-coded-domain-list/m-p/1177096#M8191</guid>
      <dc:creator>KarthikAditya</dc:creator>
      <dc:date>2022-05-25T05:32:24Z</dc:date>
    </item>
  </channel>
</rss>

