Assign Default To Field (Data Management) |
|
Release 9.2
Last modified November 29, 2010 |
![]() ![]() ![]() Print all topics in : "Tools" |
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
The default value is dependent on the field type chosen in the Field Name parameter. If you pick a field that is type LONG, the default value has to be type LONG too. For example, a valid number would be anything less than 10 numeric characters.
Adding subtypes to the default value is an optional parameter, since you do not always have subtypes to add to the default value.
A field in the feature class or table must be assigned as the subtype field before new subtypes can be added. This is done using the Set Subtype Field tool.
The subtypes of a feature class or table can also be managed in ArcCatalog. Subtypes can be created and modified using the Subtypes Property page on the dataset Properties dialog box.
The following environment affects this tool: workspace.
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 |
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 |
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)