(Added at v2.0)
Information about each field in a layer. Field objects must be constructed when creating a FeatureLayer
from a client-side feature collection. See the documentation
of the FeatureLayer constructor for more details. This class allows you to define the schema of each field in the FeatureLayer. Note that you do not need to add fields to the constructor of a FeatureLayer loaded from a service since they are already defined by the service. See the FeatureCollection
sample for an example of working with this class.
Search for samples
that use this class.
The alias name for the field.
A string that describes the default value set for a field. (Added at v3.28)
Contains information describing the purpose of each field and the various types of data each field contains. See the object specification below. (Added at v3.28)
||The various types of values that can be assigned to a field.
There are 12 possible types:
Text that represents a name, title, label, or keyword for each feature.
description - Text that provides a longer description of the feature, more than just a name or title.
typeOrCategory - Types or categories that group features based on common characteristics.
countOrAmount - Integers (no decimal) that represent how many or how much there is of a specific attribute.
percentageOrRatio - Number values in this field reflect the relationship between different quantities.
measurement - A number that reflects a characteristic that you can precisely measure.
uniqueIdentifier - The values in this field are used to positively distinguish one feature or entity from another.
orderedOrRanked - The values in this field represent a feature's status in an ordered or ranked list. For example, a feature could be one of the following:
- Small, medium, or large
- First, second, third, or fourth
- Informational, warning, error, failure
binary - Only one of two values are possible for each feature. Some examples include the following:
- On or off
- Yes or no
- True or false
- Inhabited or vacant
locationOrPlaceName - Values in this field represent a geographic location. Examples of values in such a field include a street address, city name, region, building name (such as A.K. Smiley Public Library), attraction name (such as Alameda County Fairgrounds or Cairngorms National Park), postal code, or country.
coordinate - These fields store a geographic coordinate value such as x, y, z, latitude, or longitude.
dateAndTime - Values in this field store explicit dates and times or date references such as days of the week, months, or years.
||The string value that describes the field.
Domain associated with the field.
Indicates whether the field is editable.
true | false
Indicates if the field can accept null values. Requires ArcGIS Server version 10.1 or greater. (Added at v2.6)
true | false
The data type of the field.
Can be one of the following: "esriFieldTypeSmallInteger", "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble", "esriFieldTypeString", "esriFieldTypeDate", "esriFieldTypeOID", "esriFieldTypeGeometry", "esriFieldTypeBlob", "esriFieldTypeRaster", "esriFieldTypeGUID", "esriFieldTypeGlobalID", "esriFieldTypeXML"