<?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: Sort coded value domains ArcGIS Online in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/1142282#M44264</link>
    <description>&lt;P&gt;And then apparently, repeat with each feature class that is using that domain...&lt;/P&gt;</description>
    <pubDate>Wed, 09 Feb 2022 19:11:55 GMT</pubDate>
    <dc:creator>CathyWilson2</dc:creator>
    <dc:date>2022-02-09T19:11:55Z</dc:date>
    <item>
      <title>Sort coded value domains ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/674424#M33479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Is it possible to sort a list of coded value domains in ArcGIS Online?&lt;/P&gt;&lt;P&gt;I have a hosted Feature Layer with a field with domains. When I view them in ArcGIS Online they are not sorted by the Code value. I would like them to be sorted by code value, like using the tool Sort coded value domain in ArcGIS Desktop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I couldn't find any standard way of doing this I have tried to use ArcGIS API for Python in Jupyter Notebook, and the arcpy.SortCodedValueDomain_management tool but It returns an error saying my hosted feature layer is not a valid geodatabase (see attached photo - with deliberately wrong user and password).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps someone can help me here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2019 11:03:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/674424#M33479</guid>
      <dc:creator>Kristian_BirchvaldJensen</dc:creator>
      <dc:date>2019-04-01T11:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sort coded value domains ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/674425#M33480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kristian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please have a look at the sample below.&lt;/P&gt;&lt;P&gt;This works for me:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Login to ArcGIS Online&lt;/LI&gt;&lt;LI&gt;Select the relevant layer of your Hosted Feature Layer&lt;/LI&gt;&lt;LI&gt;Create an update_dict with your coded values in the correct order and apply this to the relevant field with update_definition()&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this answer your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# This script should be run within a specific ArcGIS/Python environment using the batch file below&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# (This batch file comes with the installation of ArcGIS Pro)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# "C:\Program Files\ArcGIS\Pro\bin\Python\scripts\propy.bat" update_coded_value_domains.py&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gis &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GIS
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; provide_credentials &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; provide_credentials

username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; provide_credentials&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
my_agol &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"https://www.arcgis.com"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; password&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Get the first layer - Layer 0 - of your Hosted Feature Layer with ID &amp;lt;HFL_ID&amp;gt;&lt;/SPAN&gt;
lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; my_agol&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;get&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'&amp;lt;HFL_ID&amp;gt;'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Add domain values to the field "Color"&lt;/SPAN&gt;
update_dict &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"fields"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      &lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Color"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
      &lt;SPAN class="string token"&gt;"domain"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"type"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"codedValue"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"MY_CODED_VALUE_DOMAIN"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
      &lt;SPAN class="string token"&gt;"codedValues"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Blue"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"code"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Blue"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                     &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Green"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"code"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Green"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                     &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Orange"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"code"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Orange"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                     &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Red"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"code"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Red"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
                     &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Yellow"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"code"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Yellow"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

update &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;manager&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;update_definition&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;update_dict&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;update&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# Should give {'success': True}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:26:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/674425#M33480</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2021-12-12T04:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sort coded value domains ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/674426#M33481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any other way of doing this, without coding?&amp;nbsp; I&amp;nbsp;am having the same issues, AGOL is sorting by my Coded Value but not Name.&amp;nbsp; It would be easier for my users to have the Names in order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Jul 2019 20:23:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/674426#M33481</guid>
      <dc:creator>CassieGallagher1</dc:creator>
      <dc:date>2019-07-05T20:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sort coded value domains ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/1142266#M44263</link>
      <description>&lt;P&gt;There is another way. You can change the order in AGOL. Click your feature class that uses the domain. Click the Data tab, then click Fields at the top of the window. Click Edit next to the&amp;nbsp;List of Values (Domain). Move your mouse pointer to the left side of the value until you get the hand pointer. Left-click the mouse button and drag to the desired location. Yes, you have to sort them manually. And the result won't appear when you are linked to the feature class in ArcGIS Pro. And I can't get the list to scroll when I am dragging. (I have a domain that currently has 55 items and had to scroll from the very bottom up to the L's one screen at a time.) But this may be easier than the code method.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 18:42:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/1142266#M44263</guid>
      <dc:creator>CathyWilson2</dc:creator>
      <dc:date>2022-02-09T18:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sort coded value domains ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/1142282#M44264</link>
      <description>&lt;P&gt;And then apparently, repeat with each feature class that is using that domain...&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 19:11:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/1142282#M44264</guid>
      <dc:creator>CathyWilson2</dc:creator>
      <dc:date>2022-02-09T19:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sort coded value domains ArcGIS Online</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/1253200#M50036</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for this. I'd like to try this piece of code to reorder my domains on Enterprise. I've over 1,000 domains and when I run the "Sort coded value domain" tool in Pro, my changes are not honored when uploaded to Enterprise.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips on how to change this code from "my_AGOL" to finding my feature layer on Enterprise?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 09:20:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/sort-coded-value-domains-arcgis-online/m-p/1253200#M50036</guid>
      <dc:creator>Sara_</dc:creator>
      <dc:date>2023-01-31T09:20:30Z</dc:date>
    </item>
  </channel>
</rss>

