Domain from field


This tool allows for the creation of new coded-value attribute domains based on the values in an existing field. The tool will generate a list of unique values for the field indicated by the user and add them as a domain to the selected geodatabase.

How to use:
  1. Browse and select the dll for this sample using the 'Add From File' button on the customization dialog in ArcCatalog.
  2. From the 'Developer Samples' commands category, add the 'Domain from file' command to an existing toolbar or the context menu for a geodatabase.
  3. Use ArcCatalog to browse to the database you wish to add a domain to.
  4. Click on the command to bring up the dialog, and begin by entering a name for your domain.
  5. Use the browse button on the dialog to browse to the table of feature class containing the field to use.
  6. From the Code Field dropdown, select the field to use and then the Generate button to populate the list.
  7. Specify the target Field Type for the domain (if you switch to an integer field, the code values will be updated).
  8. If you want to convert a lookup table (a table also containing a description), select the checkbox.


Requires: Geodatabase, field with unique values for generating a domain

Difficulty: Moderate

Visual Basic
File Description
DomainFromField.cls Class for displaying the domain from field dialog.
frmDomainFromField.frm Form the dialog for the command and the code to add the domain.
GxTableFilter.cls Filter used in browsing for the table to use for generating the domain.
DomainFromFieldPrj.vbp Visual Basic project.

Key CoClasses: CodedValueDomain, DataStatistics, Table
Key Interfaces: ICodedValueDomain, IDataStatistics, IDomain, ITable
Key Members: ICodedValueDomain::AddCode, IDataStatistics::UniqueValues, IDomain::FieldType, ITable::Search