ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Set Value For Range Domain

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

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.

  • Workspace domains can also be managed in ArcCatalog or the Catalog window. Domains can be created and modified through the Domains tab on the Database Properties dialog box.

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
arcpy.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

# Import system modules
import arcpy
 
try:
    # 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)
 
except Exception as err:
    print(err.args[0])

Environments

  • Auto Commit
  • Current Workspace

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Domains toolset
  • A quick tour of subtypes
  • A quick tour of attribute domains
  • Geoprocessing considerations for attribute domains

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal