IField Interface

Provides access to members that return information about the field.

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.

Members

Name Description
Read-only property AliasName The alias name of the field.
Method CheckValue Indicates if the value is valid given the field definition.
Read-only property DefaultValue The default value of the field.
Read-only property Domain The default domain of the field.
Read-only property DomainFixed Indicates if the field's domain is fixed.
Read-only property Editable Indicates if the field is editable.
Read-only property GeometryDef The geometry definition for the field if IsGeometry is TRUE.
Read-only property IsNullable Indicates if the field can contain null values.
Read-only property Length The maximum length, in bytes, for values described by the field.
Read-only property Name The name of the field.
Read-only property Precision The precision for field values.
Read-only property Required Indicates if the field is required.
Read-only property Scale The scale for field values.
Read-only property Type The type of the field.
Read-only property VarType The VARTYPE of the field (e.g. VT_​I4).

IField.AliasName Property

The alias name of the field.

Public ReadOnly Property AliasName As String
public string AliasName {get;}

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.

IField.CheckValue Method

Indicates if the value is valid given the field definition.

Public Function CheckValue ( _
    ByVal Value As Object _
) As Boolean
public bool CheckValue (
    object Value
);

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.

IField.DefaultValue Property

The default value of the field.

Public ReadOnly Property DefaultValue As Object
public object DefaultValue {get;}

IField.Domain Property

The default domain of the field.

Public ReadOnly Property Domain As IDomain
public IDomain Domain {get;}

IField.DomainFixed Property

Indicates if the field's domain is fixed.

Public ReadOnly Property DomainFixed As Boolean
public bool DomainFixed {get;}

IField.Editable Property

Indicates if the field is editable.

Public ReadOnly Property Editable As Boolean
public bool Editable {get;}

Remarks

The Editable property of a field should always be set to TRUE. Setting it to FALSE will prevent all users from editing the contents of the field. To set a field to be read-only, use the IFieldInfo3.ReadOnly property.

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.

IField.GeometryDef Property

The geometry definition for the field if IsGeometry is TRUE.

Public ReadOnly Property GeometryDef As IGeometryDef
public IGeometryDef GeometryDef {get;}

IField.IsNullable Property

Indicates if the field can contain null values.

Public ReadOnly Property IsNullable As Boolean
public bool IsNullable {get;}

IField.Length Property

The maximum length, in bytes, for values described by the field.

Public ReadOnly Property Length As Integer
public int Length {get;}

IField.Name Property

The name of the field.

Public ReadOnly Property Name As String
public string Name {get;}

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.

IField.Precision Property

The precision for field values.

Public ReadOnly Property Precision As Integer
public int Precision {get;}

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.

IField.Required Property

Indicates if the field is required.

Public ReadOnly Property Required As Boolean
public bool Required {get;}

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.

The Required property only applies to changes to modifying the schema of a Field's properties or blocking it from being deleted. It has no impact on the ability to update or add\delete the values within the field. Also, setting the Required field property to be True will block the user from deleting the field through the GUI, as well as through ArcObjects.

IField.Scale Property

The scale for field values.

Public ReadOnly Property Scale As Integer
public int Scale {get;}

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.

IField.Type Property

The type of the field.

Public ReadOnly Property Type As esriFieldType
public esriFieldType Type {get;}

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:

  • "A comparison of ArcGIS, ArcSDE, and DB2 data types"
  • "A comparison of ArcGIS, ArcSDE, and Informix data types"
  • "A comparison of ArcGIS, ArcSDE, and PostgreSQL data types"
  • "A comparison of ArcGIS, ArcSDE, and Oracle data types"
  • "A comparison of ArcGIS, ArcSDE, and SQL Server data types"

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.

IField.VarType Property

The VARTYPE of the field (e.g. VT_I4).

Public ReadOnly Property VarType As Integer
public int VarType {get;}

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** 234587313131388

Classes that implement IField

Classes Description
Field Esri Field object.

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.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.