Select to view content in your preferred language

How to control display order of arcpy scripted coded value domain?

2677
12
Jump to solution
07-12-2017 10:33 AM
ChristopherRoss1
New Contributor II

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.

0 Kudos
12 Replies
RandyBurton
MVP Alum

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.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

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,   

0 Kudos
ChristopherRoss1
New Contributor II

This is a good option to retain the coded text in its original design, great solution.

0 Kudos