Show Navigation | Hide Navigation
You are here:
Geoprocessing tool reference > Data Management toolbox > Fields toolset > Tools

Assign Default To Field (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Tools"


Related Topics

This tool will create a default value for a specified field. It automatically applies a user-determined value to a certain field for every row added to the table or feature class. Subtypes can be part of the default behavior that is added to each new feature or row to a table.


Usage tips

Command line syntax
An overview of the Command Line window
AssignDefaultToField_management <in_table> <field_name> <default_value> {subtype_code;subtype_code...}

Parameter Explanation Data Type
<in_table>

Input table or feature class that will have a default value added to one of its fields.

Table View
<field_name>

Field that will have the default value added to it each time a new row is added to the table or feature class.

Field
<default_value>

The string for the default value to be added to each new table or feature class. The field type controls what kind of string can be added.

String
{subtype_code;subtype_code...}

The subtypes that can participate in the default value. You specify the subtypes to be used.

String
Data types for geoprocessing tool parameters


Command line example

AssignDefaultToField C:\Test_data\Redlands.mdb\rdlsStreets\street STR_TYPE paved

Scripting syntax
About getting started with writing geoprocessing scripts
AssignDefaultToField_management (in_table, field_name, default_value, subtype_code)

Parameter Explanation Data Type
in_table (Required)

Input table or feature class that will have a default value added to one of its fields.

Table View
field_name (Required)

Field that will have the default value added to it each time a new row is added to the table or feature class.

Field
default_value (Required)

The string for the default value to be added to each new table or feature class. The field type controls what kind of string can be added.

String
subtype_code (Optional)

The subtypes that can participate in the default value. You specify the subtypes to be used.

String

Data types for geoprocessing tool parameters


Script example

import arcgisscripting
gp = arcgisscripting.create()

# Set a default workspace
gp.workspace = "c:\\test_data\\hydro_lines.mdb"

# Set a default workspace
gp.toolbox = "management"

try:
    # Add a default value to this feature class
    gp.assigndefaulttofield ("gas_ln", "regulators", "230", "18: diam_1;'24: diam_2")

except:
    # If an error occurs when running assigndefaulttofield, print out the error message.
    print gp.GetMessages(2)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.