com.esri.arcgis.geodatabase
Interface IFields

All Superinterfaces:
Serializable
All Known Subinterfaces:
IFields2, IFieldsEdit
All Known Implementing Classes:
Fields

public interface IFields
extends Serializable

Provides access to members that return information about the fields.

Superseded By

IFields2

Description

The Fields object represents a collection of columns in a table. The term field is synonymous with column. Each table in a database has an ordered collection of fields, there is always at least one field in a table. The ordered collection behaves like a list, so it is possible to access individual fields by a numbered position (or index) in the list.

Remarks

The IFields interface provides information about a Fields collection and also provides access to individual fields. This example finds any fields in a feature class which have a distinct alias name.

Set pFields = pFeatureClass.Fields

For i = 0 To (pFields.FieldCount - 1)

  Set pField = pFields.Field(i)

  If (pField.Name <> pField.AliasName) Then

    Debug.Print pField.Name & “:” & pField.AliasName

  End If

Next i

When using IFields::FindField, remember that there are equivalent methods on IClass and ICursor—they are shortcuts which save you having to get the Fields collection.

When programming with ArcMap, there is a distinction between IFields and two other interfaces, ILayerFields and ITableFields. ILayerFields is particular to an ArcMap layer, so for example, an alias name belongs to the field as defined in that layer rather than being stored with the underlying table.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux


Method Summary
 int findField(String name)
          Finds the index of the named field in the fields collection.
 int findFieldByAliasName(String name)
          Finds the index of the field with the alias name in the fields collection.
 IField getField(int index)
          The field at the specified index in the fields collection.
 int getFieldCount()
          The number of fields in the fields collection.
 

Method Detail

getFieldCount

int getFieldCount()
                  throws IOException,
                         AutomationException
The number of fields in the fields collection.

Remarks

FieldCount is a one-based index. Therefore if you want to use IFields::FieldCount to get a particular index and use IFields::Field to get the field at the particular index, you will need to convert FieldCount to a zero-based index.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getField

IField getField(int index)
                throws IOException,
                       AutomationException
The field at the specified index in the fields collection.

Product Availability

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

Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IField
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

findField

int findField(String name)
              throws IOException,
                     AutomationException
Finds the index of the named field in the fields collection.

Remarks

If FindField returns -1, the Field could not be found in the Fields collection.

Developers working with SDE should be aware of qualified field names and their impact on calls to FindField. For more information, see the IFields2 interface.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

findFieldByAliasName

int findFieldByAliasName(String name)
                         throws IOException,
                                AutomationException
Finds the index of the field with the alias name in the fields collection.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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