I use a python script to create and populate coded text domain values for an SDE. The script adds the coded values in the order that I want them (using AddCodedValueToDomain_management), which is in order of usefulness, not alphabetical. My problem is that when I review the text domains in Catalog, they are in a scrambled order. Is there a way to control or change this order?
I am aware of the SortCodedValueDomain_management, but that seems to only allow ascending and descending sorting.
Solved! Go to Solution.
Typically, when I create domains, I create a table, add the fields and then import data from a spreadsheet. Then I convert the table to a domain. The process is automated with a python script. See my comments in Importing domains from Excel for a sample script.
I second Rhett Zufelt and rvburton about keeping it in a table (mine are in FGDB tables) and then replacing the domains with TableToDomains. It is easier to sort the table and it seems to always keep the order I set. I have script setup that replaces about 70 different domains (and sets subtypes) every month or as needed to both my master SDE and FGDB copies of my FCs,
This is a good option to retain the coded text in its original design, great solution.