Sort Coded Value Domain (Data Management)

Summary

Sorts the code or description of a coded value domain in either ascending or descending order.

Parameters

LabelExplanationData Type
Input Workspace
Workspace
Domain Name

The name of the coded value domain to be sorted.

String
Sort By

Specifies whether the code or description will be used to sort the domain.

  • CODERecords are sorted based on the code value for the domain.
  • DESCRIPTIONRecords are sorted based on the description value for the domain.
String
Sort Order

Specifies the direction the records will be sorted.

  • ASCENDINGRecords are sorted from low value to high value.
  • DESCENDINGRecords are sorted from high value to low value.
String

Derived Output

LabelExplanationData Type
Updated Input Workspace

The updated input workspace.

Workspace

arcpy.management.SortCodedValueDomain(in_workspace, domain_name, sort_by, sort_order)
NameExplanationData Type
in_workspace
Workspace
domain_name

The name of the coded value domain to be sorted.

String
sort_by

Specifies whether the code or description will be used to sort the domain.

  • CODERecords are sorted based on the code value for the domain.
  • DESCRIPTIONRecords are sorted based on the description value for the domain.
String
sort_order

Specifies the direction the records will be sorted.

  • ASCENDINGRecords are sorted from low value to high value.
  • DESCENDINGRecords are sorted from high value to low value.
String

Derived Output

NameExplanationData Type
out_workspace

The updated input workspace.

Workspace

Code sample

SortCodedValueDomain example (Python window)

The following Python window script demonstrates how to use the SortCodedValueDomain function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.SortCodedValueDomain_management("montgomery.gdb", "material", "CODE", "ASCENDING")

Environments

Related topics