com.esri.arcgis.geodatabase
Interface IField

All Superinterfaces:
Serializable
All Known Subinterfaces:
IField2, IFieldEdit, IFieldEdit2
All Known Implementing Classes:
Field

public interface IField
extends Serializable

Provides access to members that return information about the field.

Superseded By

IField2

Description

The field object represents a column in a table. A field has many properties, the most obvious ones being its name and its datatype. The esriFieldType enumeration lists the possible datatypes.

Remarks

When you create a field of type esriFieldTypeSingle, esriFieldTypeDouble or esriFieldTypeInteger, and specify zero for precision and scale, the geodatabase will attempt to create a binary type field if the underlying database supports it. Personal geodatabases support only binary type fields. ArcGIS ignores precision and scale of binary type fields.

The length property of a field has meaning only for esriFieldTypeString fields. The length property for all other field types is not important and will be ignored if specified.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Method Summary
 boolean checkValue(Object value)
          Indicates if the value is valid given the field definition.
 String getAliasName()
          The alias name of the field.
 Object getDefaultValue()
          The default value of the field.
 IDomain getDomain()
          The default domain of the field.
 IGeometryDef getGeometryDef()
          The geometry definition for the field if IsGeometry is TRUE.
 int getLength()
          The maximum length, in bytes, for values described by the field.
 String getName()
          The name of the field.
 int getPrecision()
          The precision for field values.
 int getScale()
          The scale for field values.
 int getType()
          The type of the field.
 int getVarType()
          The VARTYPE of the field (e.g.
 boolean isDomainFixed()
          Indicates if the field's domain is fixed.
 boolean isEditable()
          Indicates if the field is editable.
 boolean isNullable()
          Indicates if the field can contain null values.
 boolean isRequired()
          Indicates if the field is required.
 

Method Detail

getName

String getName()
               throws IOException,
                      AutomationException
The name of the field.

Remarks

Geodatabase feature classes, depending on their geometry type, may contain automatically generated fields for shape length and area. In personal and file geodatabases, these fields will be named using the name of the shape field suffixed with "_Length" and "_Area". In an SDE geodatabase, the names of these fields will be dependant on the underlying DBMS.

The IFeatureClass::ShapeFieldName property should be used to determine the name of the length and area fields for a feature class.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The name
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getAliasName

String getAliasName()
                    throws IOException,
                           AutomationException
The alias name of the field.

Remarks

This is only supported on fields from object classes and feature classes that are registered with the geodatabase; Personal, File or ArcSDE geodatabases. For fields coming from other data sources (shapefiles, coverages, etc) the AliasName will be the same string as the field name.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The name
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getType

int getType()
            throws IOException,
                   AutomationException
The type of the field.

Remarks

For more information on the relation between esriFieldType values and the underlying SDE and DBMS data types, see the following articles in the ArcGIS Help:

The following table outlines the equivalent field data types in ArcCatalog, ArcObjects and .NET:

ArcCatalog

esriFieldType

(IField::Type)

.NET Variable Type

Short Integer esriFieldTypeSmallInteger System.Int16
Long Integer esriFieldTypeInteger System.Int32
Float esriFieldTypeSingle System.Single
Double esriFieldTypeDouble System.Double
Text esriFieldTypeString System.String
Date esriFieldTypeDate System.DateTime
Object ID esriFieldTypeOID System.Int32
Geometry esriFieldTypeGeometry ESRI.ArcGIS.Geometry.IGeometry
Blob esriFieldTypeBlob ESRI.ArcGIS.esriSystem.IMemoryBlobStream
Raster esriFieldTypeRaster ESRI.ArcGIS.Geodatabase.IRasterValue
GUID esriFieldTypeGUID System.String
GlobalID esriFieldTypeGlobalID System.String

The following table outlines the Coverage, INFO Item to Geodatabase field mapping:

Item type Item width Geodatabase field type (esriFieldType)
B 4 esriFieldTypeInteger
C 1-320 esriFieldTypeString
D 8 esriFieldTypeDate
F 4 esriFieldTypeSingle
F 8 esriFieldTypeDouble
I 1-4 esriFieldTypeSmallInteger
I 5-9 esriFieldTypeInteger
I 10-16 esriFieldTypeDouble
N 1-9 esriFieldTypeSingle
N 10-16 esriFieldTypeDouble

The following table outlines the Shapefile, dBASE field to Geodatabase field mapping:

Field type Field width Geodatabase field type (esriFieldType)
Date - esriFieldTypeDate
String 1-255 esriFieldTypeString
Boolean - esriFieldTypeString
Number 1-16 (decimals = 0) esriFieldTypeInteger
Number 1-16 (decimals > 0) esriFieldTypeDouble
Note: Shapefiles only support date fields. Time is not supported. Geodatabases support date\time fields. If a shapefiles date field is queried for the time a default value of "12:00:00 AM" will be returned.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
A com.esri.arcgis.geodatabase.esriFieldType constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDomain

IDomain getDomain()
                  throws IOException,
                         AutomationException
The default domain of the field.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.geodatabase.IDomain
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IField

getDefaultValue

Object getDefaultValue()
                       throws IOException,
                              AutomationException
The default value of the field.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLength

int getLength()
              throws IOException,
                     AutomationException
The maximum length, in bytes, for values described by the field.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The length
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getPrecision

int getPrecision()
                 throws IOException,
                        AutomationException
The precision for field values.

Remarks

Precision is the number of digits in a number. For example, the number 56.78 has a precision of 4. Precision is only valid for fields that are numeric. Precision is always returned as 0 from personal or File geodatabase fields.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The length
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getScale

int getScale()
             throws IOException,
                    AutomationException
The scale for field values.

Remarks

Scale is the number of digits to the right of the decimal point in a number. For example, the number 56.78 has a scale of 2. Scale applies only to fields that are double. Scale is always returned as 0 from personal or File geodatabase fields.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The length
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isNullable

boolean isNullable()
                   throws IOException,
                          AutomationException
Indicates if the field can contain null values.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The isNullable
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getGeometryDef

IGeometryDef getGeometryDef()
                            throws IOException,
                                   AutomationException
The geometry definition for the field if IsGeometry is TRUE.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.geodatabase.IGeometryDef
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getVarType

int getVarType()
               throws IOException,
                      AutomationException
The VARTYPE of the field (e.g. VT_I4).

Description

Returns an Integer indicating the subtype of a variable.

Remarks

The following is a list of the VARTYPE constants that can be returned from this property.
Field type VarType

esriFieldTypeSmallInteger

esriFieldTypeInteger

esriFieldTypeSingle

esriFieldTypeDouble

esriFieldTypeString

esriFieldTypeDate

esriFieldTypeOID

esriFieldTypeGeometry

esriFieldTypeBlob

esriFieldTypeRaster

esriFieldTypeGUID

esriFieldTypeGlobalID

2

3

4

5

8

7

3

13

13

13

8

8

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The varType
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isDomainFixed

boolean isDomainFixed()
                      throws IOException,
                             AutomationException
Indicates if the field's domain is fixed.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The isFixed
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IClassSchemaEdit.alterDomain(String, com.esri.arcgis.geodatabase.IDomain), IClassSchemaEdit

isRequired

boolean isRequired()
                   throws IOException,
                          AutomationException
Indicates if the field is required.

Description

All tables and feature classes have a set of required fields that are necessary to record the state of any particular object in the table or feature class. These required fields are automatically created when you create a new feature class or table, and cannot be deleted. Required fields may also have required properties such as its domain property. You cannot modify the required property of a required field.

For example, in a simple feature class, OID and Shape are required fields. They do have properties such as their alias and geometry type that you can modify, but these fields cannot be deleted.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The isRequired
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isEditable

boolean isEditable()
                   throws IOException,
                          AutomationException
Indicates if the field is editable.

Remarks

It is best to loop through the fields of a feature and skip the fields that are not editable, rather than allowing users to attempt to edit fields that cannot be edited.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The isEditable
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

checkValue

boolean checkValue(Object value)
                   throws IOException,
                          AutomationException
Indicates if the value is valid given the field definition.

Description

CheckValue tests whether the specified value is valid for the current field, based upon the field type. For example, CheckValue will verify if the supplied value corresponds to field type of Small Integer or if the value corresponds to a string value.

The value is not checked against any existing domain.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
value - A Variant (in)
Returns:
The isValidValue
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.