Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: Field

require(["esri/layers/Field"], function(Field) { /* code goes here */ });

Description

(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.

Samples

Search for samples that use this class.

Properties

NameTypeSummary
aliasStringThe alias name for the field.
defaultValueStringA string that describes the default value set for a field.
descriptionObjectContains information describing the purpose of each field and the various types of data each field contains.
domainDomainDomain associated with the field.
editableBooleanIndicates whether the field is editable.
lengthNumberThe field length.
nameStringThe name of the field.
nullableBooleanIndicates if the field can accept null values.
typeStringThe data type of the field.
Property Details

<String> alias

The alias name for the field.

<String> defaultValue

A string that describes the default value set for a field. (Added at v3.28)

<Object> description

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)
Object Specifications:
<description>
<String> fieldValueType Required The various types of values that can be assigned to a field.

There are 12 possible types:

  • nameOrTitle - 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.

<String> value Required The string value that describes the field.
Sample: {"value":"State FIPS code. Federal Information Processing Standards (FIPS) are numeric codes assigned by the National Institute of Standards and Technology (NIST). FIPS codes identify US states by a 2-digit number, and US counties by a 3-digit number.","fieldValueType":"typeOrCategory"}

<Domain> domain

Domain associated with the field.

<Boolean> editable

Indicates whether the field is editable.
Known values: true | false

<Number> length

The field length

<String> name

The name of the field.

<Boolean> nullable

Indicates if the field can accept null values. Requires ArcGIS Server version 10.1 or greater. (Added at v2.6)
Known values: true | false

<String> type

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"
Show Modal