Set Value For Range Domain (Data Management)

Summary

Sets the minimum and maximum values for an existing Range domain.

Usage

  • A range domain specifies a valid range of values for a numeric attribute. For example, a valid range of water main pressure values might be between 50 and 75 psi.

  • Domain management involves the following steps:

    1. Create the domain using the Create Domain tool.
    2. Add values to or set the range of values for the domain using the Add Coded Value To Domain tool or this tool.
    3. Associate the domain with a feature class using the Assign Domain To Field tool.

  • You can also manage domains in Domains view which can be opened by clicking the Domains button found in the Design group on the Data ribbon.

Parameters

LabelExplanationData Type
Input Workspace

The geodatabase containing the domain to be updated.

Workspace
Domain Name

The name of the range domain to be updated.

String
Minimum Value

The minimum value of the range domain.

String
Maximum Value

The maximum value of the range domain.

String

Derived Output

LabelExplanationData Type
Updated Workspace

The updated workspace.

Workspace

arcpy.management.SetValueForRangeDomain(in_workspace, domain_name, min_value, max_value)
NameExplanationData Type
in_workspace

The geodatabase containing the domain to be updated.

Workspace
domain_name

The name of the range domain to be updated.

String
min_value

The minimum value of the range domain.

String
max_value

The maximum value of the range domain.

String

Derived Output

NameExplanationData Type
out_workspace

The updated workspace.

Workspace

Code sample

SetValueForRangeDomain example 1 (Python window)

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

import arcpy
arcpy.env.workspace =  "C:/data"
arcpy.SetValueForRangeDomain_management("montgomery.gdb", "RotAngle", 0, 359)
SetValueForRangeDomain example 2 (stand-alone script)

This stand-alone script uses the SetValueForRangeDomain function as part of a workflow to create a range attribute domain.

# Name: CreateRangeDomain.py
# Purpose: Create an attribute domain to constrain valid rotation angle

# Import system modules
import arcpy
 
# Set the workspace (to avoid having to type in the full path to the data every time)
arcpy.env.workspace = "C:/data"

# Set local parameters
dWorkspace = "montgomery.gdb"
domName = "RotAngle2"
domDesc = "Valid rotation angle"
minRange = 0
maxRange = 359
inFeatures = "Montgomery.gdb/Water/fittings"
inField = "ANGLE"

# Process: Create the range domain
arcpy.CreateDomain_management(dWorkspace, domName, domDesc, "LONG", "RANGE")

# Process: Set the minimum and maximum values for the range domain
arcpy.SetValueForRangeDomain_management(dWorkspace, domname, minRange, maxRange)

# Process: Constrain the fitting rotation angle
arcpy.AssignDomainToField_management( inFeatures, inField, domName)

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics