<?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>idea Improved Coded Value Domain Sorting Using SQL Statements in Data Management Ideas</title>
    <link>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idi-p/926488</link>
    <description>&lt;P&gt;I have a coded value domain that is called fcDiameter, and it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;1 - 1&lt;/P&gt;&lt;P&gt;2 - 2&lt;/P&gt;&lt;P&gt;102375 - 2.375&lt;/P&gt;&lt;P&gt;48 - 48&lt;/P&gt;&lt;P&gt;42 - 42&lt;/P&gt;&lt;P&gt;0 - Unknown&lt;/P&gt;&lt;P&gt;100500 - 1.500&lt;/P&gt;&lt;P&gt;-1 - Unknown (Verified)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to sort by description with number-like descriptions sorted numerically followed by text descriptions.&amp;nbsp; You should add functionality to coded value domain management allowing for SQL statements to be used for changing the order where sorting by code or by description ASC or DSC alone is not providing the desired results.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For example, if I were to query the domain table in Oracle,&amp;nbsp;a select query that would return the desired order would look like this:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;SPAN&gt;SELECT * FROM CVD_VW_FCDIAMETER ORDER BY REGEXP_SUBSTR(DESCRIPTION, '^\D*') NULLS FIRST, TO_NUMBER(REGEXP_SUBSTR(DESCRIPTION, '\d+'))&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the results of the query would look like this:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;1 - 1&lt;/P&gt;&lt;P&gt;100500 - 1.500&lt;/P&gt;&lt;P&gt;2 - 2&lt;/P&gt;&lt;P&gt;1002375 - 2.375&lt;/P&gt;&lt;P&gt;42 - 42&lt;/P&gt;&lt;P&gt;48 - 48&lt;/P&gt;&lt;P&gt;0 - Unknown&lt;/P&gt;&lt;P&gt;-1 - Unknown (Verified)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Thu, 25 Aug 2022 22:35:47 GMT</pubDate>
    <dc:creator>ZacharyOrdo__GISP</dc:creator>
    <dc:date>2022-08-25T22:35:47Z</dc:date>
    <item>
      <title>Improved Coded Value Domain Sorting Using SQL Statements</title>
      <link>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idi-p/926488</link>
      <description>&lt;P&gt;I have a coded value domain that is called fcDiameter, and it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;1 - 1&lt;/P&gt;&lt;P&gt;2 - 2&lt;/P&gt;&lt;P&gt;102375 - 2.375&lt;/P&gt;&lt;P&gt;48 - 48&lt;/P&gt;&lt;P&gt;42 - 42&lt;/P&gt;&lt;P&gt;0 - Unknown&lt;/P&gt;&lt;P&gt;100500 - 1.500&lt;/P&gt;&lt;P&gt;-1 - Unknown (Verified)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to sort by description with number-like descriptions sorted numerically followed by text descriptions.&amp;nbsp; You should add functionality to coded value domain management allowing for SQL statements to be used for changing the order where sorting by code or by description ASC or DSC alone is not providing the desired results.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For example, if I were to query the domain table in Oracle,&amp;nbsp;a select query that would return the desired order would look like this:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;SPAN&gt;SELECT * FROM CVD_VW_FCDIAMETER ORDER BY REGEXP_SUBSTR(DESCRIPTION, '^\D*') NULLS FIRST, TO_NUMBER(REGEXP_SUBSTR(DESCRIPTION, '\d+'))&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the results of the query would look like this:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;1 - 1&lt;/P&gt;&lt;P&gt;100500 - 1.500&lt;/P&gt;&lt;P&gt;2 - 2&lt;/P&gt;&lt;P&gt;1002375 - 2.375&lt;/P&gt;&lt;P&gt;42 - 42&lt;/P&gt;&lt;P&gt;48 - 48&lt;/P&gt;&lt;P&gt;0 - Unknown&lt;/P&gt;&lt;P&gt;-1 - Unknown (Verified)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 25 Aug 2022 22:35:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idi-p/926488</guid>
      <dc:creator>ZacharyOrdo__GISP</dc:creator>
      <dc:date>2022-08-25T22:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Improved Coded Value Domain Sorting Using SQL Statements</title>
      <link>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idc-p/1385855#M2349</link>
      <description>&lt;P&gt;I would like a sort order field added to the domain table so that I can specify what should be on top to meet the needs of the day.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 04:59:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idc-p/1385855#M2349</guid>
      <dc:creator>cspielman_bouldercounty</dc:creator>
      <dc:date>2024-02-23T04:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Improved Coded Value Domain Sorting Using SQL Statements</title>
      <link>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idc-p/1385927#M2351</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/100488"&gt;@ZacharyOrdo__GISP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder, as a last resort, if you could use some sort of scheduled/nightly Python script to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Export the domain to an Oracle or Mobile Geodatabase table using Domain to Table.&lt;/LI&gt;&lt;LI&gt;An existing database view or query layer (EGDB only) could sort the domain using your SQL query.&lt;/LI&gt;&lt;LI&gt;Delete the domain values via&amp;nbsp;Delete Coded Value From Domain.&lt;/LI&gt;&lt;LI&gt;Replace the domain values via Add Coded Value To Domain using the rows in your database view.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Related:&amp;nbsp;&lt;A href="https://gis.stackexchange.com/questions/434760/select-domain-codes-descriptions-using-xmltable-instead-of-extractvalue" target="_self"&gt;Select domain codes/descriptions using XMLTABLE instead of EXTRACTVALUE&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I haven’t tested replacing domain values. I’m not sure if/how that would work. Maybe&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/7880"&gt;@MarceloMarques&lt;/a&gt;&amp;nbsp;would have some insight.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 10:21:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idc-p/1385927#M2351</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-02-23T10:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Improved Coded Value Domain Sorting Using SQL Statements</title>
      <link>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idc-p/1386084#M2352</link>
      <description>&lt;P&gt;I think the esri domain concept used to me implemented using database check constraints. I'm not sure if that is still the case.&lt;/P&gt;&lt;P&gt;I think the domain might complain if feature classes are already pointing to it.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 16:15:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-ideas/improved-coded-value-domain-sorting-using-sql/idc-p/1386084#M2352</guid>
      <dc:creator>BillFox</dc:creator>
      <dc:date>2024-02-23T16:15:54Z</dc:date>
    </item>
  </channel>
</rss>

