Set Value For Range Domain (Data Management)

License Level:BasicStandardAdvanced

Summary

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

Usage

Syntax

SetValueForRangeDomain_management (in_workspace, domain_name, min_value, max_value)
ParameterExplanationData 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

Code Sample

Set Value for Range Domain Example (Python Window)

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

import arcpy
from arcpy import env
env.workspace =  "C:/data"
arcpy.SetValueForRangeDomain_management("montgomery.gdb", "RotAngle", 0, 359)
Set Value for Range Domain 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
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env
 
try:
    # Set the workspace (to avoid having to type in the full path to the data every time)
    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)
 
except Exception, e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "Line %i" % tb.tb_lineno
    print e.message

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015