com.esri.arcgis.geoprocessing.tools.datamanagementtools
Class AddField
java.lang.Object
com.esri.arcgis.geoprocessing.AbstractGPTool
com.esri.arcgis.geoprocessing.tools.datamanagementtools.AddField
- All Implemented Interfaces:
- GPTool
public class AddField
- extends AbstractGPTool
Adds a new field to a table or the table of a feature class, feature layer, raster catalog, and/or rasters with attribute tables.
The Add Field tool is contained in the Data Management Tools tool box.
Usage tips:
- Coverages, stand-alone tables, feature classes from ArcSDE and personal or file geodatabases, layer files, raster catalogs, and shapefiles will work as valid input for this command. VPF and CAD feature data overlays will not work since they are read-only formats that are not native to ArcGIS.
- For coverages, shapefiles, and dBase tables, if field type defines a character, blanks are inserted for each record. If field type defines a numeric item, zeros are inserted for each record.
- The added field will always be displayed at the end of the table.
- The Field Length parameter is only applicable on fields of type text or blob.
- For geodatabases, if field type defines a character or number is inserted into each record if the Field Is Nullible parameter default is accepted.
- A shapefile does not support alias for fields, so you cannot add a field alias to a shapefile.
- It is only possible to add a field that is not nullable to an empty geodatabase feature class or table. This tool cannot add a field that is not nullable when the rows already exist.
- The Field Domain parameter can use an existing domain from a feature class in a personal, file, or SDE geodatabase.
- The precision and scale of a field describe the maximum size and precision of data that can be stored in the field. The precision describes the number of digits that can be stored in the field and the scale describes the number of decimal places for float and double fields. For example, if the field value is 54.234, then scale = 3 and precision = 5.Use the following guidelines for choosing the correct field type for a given precision and scale:
- When creating a new field in a geodatabase feature class or table, you can specify the field's type, but not its precision, and scale. Even if the dialog box allows you to add a value for precision or scale, it will be ignored during execution.
- The name of an existing domain must be specified for the Field Domain parameter. Entering invalid domain names or values will not cause the tool to fail but it will be ignored and no domain will be set for the field.
- Fields set as REQUIRED are permanent and you will not be able to delete them with future processing. To allow for deletion at a later time set the field to NON_REQUIRED (the default).
- A field of type raster allows you to have a raster image as an attribute. It is stored within or alongside the geodatabase. This is helpful when a picture is the best way to describe a feature. Precision, scale, and length cannot be set for fields of type raster.
Constructor Summary |
AddField()
Creates the Add Field tool with defaults. |
AddField(java.lang.Object inTable,
java.lang.String fieldName,
java.lang.String fieldType)
Creates the Add Field tool with the required parameters. |
Method Summary |
java.lang.String |
getFieldAlias()
Returns the Field Alias parameter of this tool . |
java.lang.String |
getFieldDomain()
Returns the Field Domain parameter of this tool . |
java.lang.String |
getFieldIsNullable()
Returns the Field IsNullable parameter of this tool . |
java.lang.String |
getFieldIsRequired()
Returns the Field IsRequired parameter of this tool . |
int |
getFieldLength()
Returns the Field Length parameter of this tool . |
java.lang.String |
getFieldName()
Returns the Field Name parameter of this tool . |
int |
getFieldPrecision()
Returns the Field Precision parameter of this tool . |
int |
getFieldScale()
Returns the Field Scale parameter of this tool . |
java.lang.String |
getFieldType()
Returns the Field Type parameter of this tool . |
java.lang.Object |
getInTable()
Returns the Input Table parameter of this tool . |
java.lang.Object |
getOutTable()
Returns the Output Feature Class parameter of this tool (Read only). |
java.lang.String |
getToolboxAlias()
Returns the alias of the tool box containing this tool. |
java.lang.String |
getToolboxName()
Returns the name of the tool box containing this tool. |
java.lang.String |
getToolName()
Returns the name of this tool. |
void |
setFieldAlias(java.lang.String fieldAlias)
Sets the Field Alias parameter of this tool . |
void |
setFieldDomain(java.lang.String fieldDomain)
Sets the Field Domain parameter of this tool . |
void |
setFieldIsNullable(java.lang.String fieldIsNullable)
Sets the Field IsNullable parameter of this tool . |
void |
setFieldIsRequired(java.lang.String fieldIsRequired)
Sets the Field IsRequired parameter of this tool . |
void |
setFieldLength(int fieldLength)
Sets the Field Length parameter of this tool . |
void |
setFieldName(java.lang.String fieldName)
Sets the Field Name parameter of this tool . |
void |
setFieldPrecision(int fieldPrecision)
Sets the Field Precision parameter of this tool . |
void |
setFieldScale(int fieldScale)
Sets the Field Scale parameter of this tool . |
void |
setFieldType(java.lang.String fieldType)
Sets the Field Type parameter of this tool . |
void |
setInTable(java.lang.Object inTable)
Sets the Input Table parameter of this tool . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AddField
public AddField()
- Creates the Add Field tool with defaults.
Initializes the array of tool parameters with the default values specified when the tool was created.
AddField
public AddField(java.lang.Object inTable,
java.lang.String fieldName,
java.lang.String fieldType)
- Creates the Add Field tool with the required parameters.
Initializes the array of tool parameters with the values as specified for the required parameters and with the default values for the other parameters.
- Parameters:
inTable
- the input table to which the specified field will be added. The field will be added to the existing input table and will not create a new output table. fields can be added to feature classes of ArcSDE, file or personal geodatabases, coverages, shapefiles, raster catalogs, stand-alone tables, rasters with attribute tables, and/or layers.fieldName
- the name of the field that will be added to the Input Table.fieldType
- the field type used in the creation of the new field.
getInTable
public java.lang.Object getInTable()
- Returns the Input Table parameter of this tool .
This parameter is the input table to which the specified field will be added. The field will be added to the existing input table and will not create a new output table. fields can be added to feature classes of ArcSDE, file or personal geodatabases, coverages, shapefiles, raster catalogs, stand-alone tables, rasters with attribute tables, and/or layers.
This is a required parameter.
- Returns:
- the Input Table
setInTable
public void setInTable(java.lang.Object inTable)
- Sets the Input Table parameter of this tool .
This parameter is the input table to which the specified field will be added. The field will be added to the existing input table and will not create a new output table. fields can be added to feature classes of ArcSDE, file or personal geodatabases, coverages, shapefiles, raster catalogs, stand-alone tables, rasters with attribute tables, and/or layers.
This is a required parameter.
- Parameters:
inTable
- the input table to which the specified field will be added. The field will be added to the existing input table and will not create a new output table. fields can be added to feature classes of ArcSDE, file or personal geodatabases, coverages, shapefiles, raster catalogs, stand-alone tables, rasters with attribute tables, and/or layers.
getFieldName
public java.lang.String getFieldName()
- Returns the Field Name parameter of this tool .
This parameter is the name of the field that will be added to the Input Table.
This is a required parameter.
- Returns:
- the Field Name
setFieldName
public void setFieldName(java.lang.String fieldName)
- Sets the Field Name parameter of this tool .
This parameter is the name of the field that will be added to the Input Table.
This is a required parameter.
- Parameters:
fieldName
- the name of the field that will be added to the Input Table.
getFieldType
public java.lang.String getFieldType()
- Returns the Field Type parameter of this tool .
This parameter is the field type used in the creation of the new field.
This is a required parameter.
- Returns:
- the Field Type
setFieldType
public void setFieldType(java.lang.String fieldType)
- Sets the Field Type parameter of this tool .
This parameter is the field type used in the creation of the new field.
This is a required parameter.
- Parameters:
fieldType
- the field type used in the creation of the new field.
getFieldPrecision
public int getFieldPrecision()
- Returns the Field Precision parameter of this tool .
This parameter is describes the number of digits that can be stored in the field. All digits are counted no matter what side of the decimal they are on. if the input table is a personal or file geodatabase the field precision value will be ignored.
This is an optional parameter.
- Returns:
- the Field Precision
setFieldPrecision
public void setFieldPrecision(int fieldPrecision)
- Sets the Field Precision parameter of this tool .
This parameter is describes the number of digits that can be stored in the field. All digits are counted no matter what side of the decimal they are on. if the input table is a personal or file geodatabase the field precision value will be ignored.
This is an optional parameter.
- Parameters:
fieldPrecision
- describes the number of digits that can be stored in the field. All digits are counted no matter what side of the decimal they are on. if the input table is a personal or file geodatabase the field precision value will be ignored.
getFieldScale
public int getFieldScale()
- Returns the Field Scale parameter of this tool .
This parameter is sets the number of decimal places stored in a field. This parameter is only used in Float and Double data field types. if the input table is a personal or file geodatabase the field scale value will be ignored.
This is an optional parameter.
- Returns:
- the Field Scale
setFieldScale
public void setFieldScale(int fieldScale)
- Sets the Field Scale parameter of this tool .
This parameter is sets the number of decimal places stored in a field. This parameter is only used in Float and Double data field types. if the input table is a personal or file geodatabase the field scale value will be ignored.
This is an optional parameter.
- Parameters:
fieldScale
- sets the number of decimal places stored in a field. This parameter is only used in Float and Double data field types. if the input table is a personal or file geodatabase the field scale value will be ignored.
getFieldLength
public int getFieldLength()
- Returns the Field Length parameter of this tool .
This parameter is the length of the field being added. This sets the maximum number of allowable characters for each record of the field. This option is only applicable on fields of type text or blob.
This is an optional parameter.
- Returns:
- the Field Length
setFieldLength
public void setFieldLength(int fieldLength)
- Sets the Field Length parameter of this tool .
This parameter is the length of the field being added. This sets the maximum number of allowable characters for each record of the field. This option is only applicable on fields of type text or blob.
This is an optional parameter.
- Parameters:
fieldLength
- the length of the field being added. This sets the maximum number of allowable characters for each record of the field. This option is only applicable on fields of type text or blob.
getFieldAlias
public java.lang.String getFieldAlias()
- Returns the Field Alias parameter of this tool .
This parameter is the alternate name given to the field name. This name is used to give more descriptive names to cryptic field names. The field alias parameter only applies to geodatabases and coverages.
This is an optional parameter.
- Returns:
- the Field Alias
setFieldAlias
public void setFieldAlias(java.lang.String fieldAlias)
- Sets the Field Alias parameter of this tool .
This parameter is the alternate name given to the field name. This name is used to give more descriptive names to cryptic field names. The field alias parameter only applies to geodatabases and coverages.
This is an optional parameter.
- Parameters:
fieldAlias
- the alternate name given to the field name. This name is used to give more descriptive names to cryptic field names. The field alias parameter only applies to geodatabases and coverages.
getFieldIsNullable
public java.lang.String getFieldIsNullable()
- Returns the Field IsNullable parameter of this tool .
This parameter is a geographic feature where there is no associated attribute information. These are different from zero or empty fields and are only supported for fields in a geodatabase.
This is an optional parameter.
- Returns:
- the Field IsNullable
setFieldIsNullable
public void setFieldIsNullable(java.lang.String fieldIsNullable)
- Sets the Field IsNullable parameter of this tool .
This parameter is a geographic feature where there is no associated attribute information. These are different from zero or empty fields and are only supported for fields in a geodatabase.
This is an optional parameter.
- Parameters:
fieldIsNullable
- a geographic feature where there is no associated attribute information. These are different from zero or empty fields and are only supported for fields in a geodatabase.
getFieldIsRequired
public java.lang.String getFieldIsRequired()
- Returns the Field IsRequired parameter of this tool .
This parameter is specifies whether the field being created is a required field for the table; only supported for fields in a geodatabase.
This is an optional parameter.
- Returns:
- the Field IsRequired
setFieldIsRequired
public void setFieldIsRequired(java.lang.String fieldIsRequired)
- Sets the Field IsRequired parameter of this tool .
This parameter is specifies whether the field being created is a required field for the table; only supported for fields in a geodatabase.
This is an optional parameter.
- Parameters:
fieldIsRequired
- specifies whether the field being created is a required field for the table; only supported for fields in a geodatabase.
getFieldDomain
public java.lang.String getFieldDomain()
- Returns the Field Domain parameter of this tool .
This parameter is used to constrain the values allowed in any particular attribute for a table, feature class, or subtype in a geodatabase. You must specify the name of an existing domain for it to be applied to the field.
This is an optional parameter.
- Returns:
- the Field Domain
setFieldDomain
public void setFieldDomain(java.lang.String fieldDomain)
- Sets the Field Domain parameter of this tool .
This parameter is used to constrain the values allowed in any particular attribute for a table, feature class, or subtype in a geodatabase. You must specify the name of an existing domain for it to be applied to the field.
This is an optional parameter.
- Parameters:
fieldDomain
- used to constrain the values allowed in any particular attribute for a table, feature class, or subtype in a geodatabase. You must specify the name of an existing domain for it to be applied to the field.
getOutTable
public java.lang.Object getOutTable()
- Returns the Output Feature Class parameter of this tool (Read only).
This is an derived parameter.
- Returns:
- the Output Feature Class
getToolName
public java.lang.String getToolName()
- Returns the name of this tool.
- Returns:
- the tool name
getToolboxName
public java.lang.String getToolboxName()
- Returns the name of the tool box containing this tool.
- Returns:
- the tool box name
getToolboxAlias
public java.lang.String getToolboxAlias()
- Returns the alias of the tool box containing this tool.
- Returns:
- the tool box alias