Feature functions
A set of functions for working with features.
Domain
Domain(inputFeature, fieldName) -> Dictionary
Function bundle: Core
Returns the domain assigned to the given field of the provided feature
. If the feature
belongs to a class with a subtype, this returns the domain assigned to the subtype.
Parameters
- inputFeature: Feature - The Feature with a field that has a domain.
- fieldName: Text - The name of the field (not the alias of the field) assigned the domain.
Return value: Dictionary
Returns a dictionary described by the properties below.
- type: Text - The type of domain - either
coded
orValue range
. - name: Text - The domain name.
- dataType: Text - The data type of the domain field. It can be one of the following values:
esri
,Field Type Small Integer esri
,Field Type Integer esri
,Field Type Single esri
,Field Type Double esri
,Field Type String esri
,Field Type Date esri
,Field Type OID esri
,Field Type Geometry esri
,Field Type Blob esri
,Field Type Raster esri
,Field Type GUID esri
,Field Type Global I D esri
.Field Type XML - codedValues: Array<Dictionary> - Only applicable to
coded
domains. An array of dictionaries describing the valid values for the field. Each dictionary has aValue code
property, which contains the actual field value, and aname
property containing a user-friendly description of the value (e.g.{ code:
).1, name: "pavement" } - min: Number - Only applicable to
range
domains. The minimum value of the domain. - max: Number - Only applicable to
range
domains. The maximum value of the domain.
Example
The domain assigned to the feature's subtype
DomainCode
DomainCode(inputFeature, fieldName, value?, subtype?) -> Number | Text
Function bundle: Core
Returns the code of an associated domain description in a feature.
Parameters
- inputFeature: Feature - The feature with a field that has a domain.
- fieldName: Text - The name of the field (not the alias of the field) containing the domain.
- value (Optional): Text - The value to be converted back into a code.
- subtype (Optional): Number | Text - The coded number or name for the subtype if the feature supports subtyping. If not provided, the current feature's subtype (if it has one), will be used.
Example
prints the domain description for the field referenced.
DomainName
DomainName(inputFeature, fieldName, code?, subtype?) -> Text
Function bundle: Core
Returns the descriptive name for a domain code in a feature.
Parameters
- inputFeature: Feature - The feature with a field that has a domain.
- fieldName: Text - The name of the field (not the alias of the field) containing the domain.
- code (Optional): Number | Text - The code associated with the desired descriptive name. If not provided, the field value in the feature will be returned.
- subtype (Optional): Number | Text - The coded number or name of the subtype if the feature supports subtyping. If not provided, the feature's subtype (if it has one) will be used.
Return value: Text
Example
prints the domain description for the referenced field
Expects
Expects(inputFeature, field1, [field2, ..., fieldN]?) -> Null
Function bundle: Core
Requests additional attributes for the given feature. In some profiles, such as Visualization and Labeling, apps only request the data attributes required for rendering each feature or label. Some expressions dynamically reference field names with variables rather than text literals. This makes it hard for rendering and labeling engines to detect fields required for rendering. This function allows you to explicitly indicate required fields as a list. You can also request all or a subset of fields using a wildcard. Because expressions execute on a per feature basis, the wildcard should be used with caution, especially in layers containing many features. Requesting too much data can result in very poor app performance.
Parameters
- inputFeature: Feature - The feature to which the requested fields will be attached.
- field1: Text - A field name to request for the given feature. List only fields required for use in the expression. If necessary, you can request all fields using the wildcard
*
character. However, this should be avoided to prevent loading an unnecessary amount of data that can negatively impact app performance. - [field2, ..., fieldN] (Optional): Text - An ongoing list of field names to request for the given feature. List only fields required for use in the expression.
Return value: Null
Examples
Requests fields not easily detected by the renderer
Requests all data matching a pattern in the field name
Requests all data for the feature
Feature
This function has 3 signatures:
- Feature(featureGeometry, attribute1, value1, [attribute2, value2, ..., attributeN, valueN]?) -> Feature
- Feature(otherFeature) -> Feature
- Feature(featureGeometry, attributes) -> Feature
Feature(featureGeometry, attribute1, value1, [attribute2, value2, ..., attributeN, valueN]?) -> Feature
Function bundle: Core
Creates a new feature.
Parameters
- featureGeometry: Geometry - The geometry of the feature.
- attribute1: Text - The first attribute's name.
- value1: Text | Date | Number | Boolean - The first attribute's value.
- [attribute2, value2, ..., attributeN, valueN] (Optional): Any - Ongoing name/value pairs for each attribute in the feature.
Return value: Feature
Example
Feature(otherFeature) -> Feature
Function bundle: Core
Creates a new feature.
Parameter
- otherFeature: Feature | Text - The feature used to create a new feature or serialized JSON representing a feature.
Return value: Feature
Example
Feature(featureGeometry, attributes) -> Feature
Function bundle: Core
Creates a new feature.
Parameters
- featureGeometry: Geometry - The geometry of the feature.
- attributes: Dictionary - A dictionary containing the attributes and their value.
Return value: Feature
Example
GdbVersion
GdbVersion(inputFeature) -> Text
Function bundle: Core
Returns the name of the current geodatabase version for branch or versioned data. When the data is not in a multi-user geodatabase, an empty text value will be returned. See Overview of Versioning for more information.
Parameter
- inputFeature: Feature - A Feature from which to return the current geodatabase version of the associated layer.
Return value: Text
Example
Returns the geodatabase version of the given feature
Schema
Schema(inputFeature) -> Dictionary
Function bundle: Core
Profiles: Attribute Rules | Dashboard Data | Popups | Field Calculation | Form Calculation | Velocity | Tasks
Returns the schema description of the provided Feature.
Parameter
- inputFeature: Feature - The feature whose schema to return.
Return value: Dictionary
Returns a dictionary described by the properties below.
- fields: Array<Dictionary> - Returns an array of dictionaries describing the fields in the Feature. Each dictionary describes the field
name
,alias
,type
,subtype
,domain
,length
, and whether it iseditable
andnullable
. - geometryType: Text - The geometry type of features in the Feature. Returns
esri
for tables with no geometry.Geometry Null
Possible values:esri
,Geometry Point esri
,Geometry Line esri
,Geometry Polygon esri
Geometry Null - globalIdField: Text - The global ID field of the Feature. Returns
""
if not globalId-enabled. - objectIdField: Text - The objectId field of the Feature.
SubtypeCode
SubtypeCode(inputFeature) -> Number | Text | Date
Function bundle: Core
Returns the subtype code for a given feature.
Parameter
- inputFeature: Feature - The Feature from which to get the subtype code.
Return value: Number | Text | Date
Example
Returns the code of the subtype
SubtypeName
SubtypeName(inputFeature) -> Text
Function bundle: Core
Returns the subtype name for a given feature.
Parameter
- inputFeature: Feature - The Feature from which to get the subtype name.
Return value: Text
Example
Returns the name of the subtype
Subtypes
Subtypes(inputFeature) -> Dictionary
Function bundle: Core
Returns the subtype coded value Dictionary. Returns null
when subtypes are not enabled on the layer.
Parameter
- inputFeature: Feature - The Feature from which to get subtypes.
Return value: Dictionary
Returns a dictionary described by the properties below.
- subtypeField: Text - The field containing a subtype.
- subtypes: Array<Dictionary> - An array of dictionaries describing the subtypes. Each dictionary has a
code
property, which contains the actual field value, and aname
property containing a user-friendly description of the value (e.g.{ code:
)1, name: "pavement" }
Example
Returns subtypes with coded values from a feature