Skip To Content ArcGIS for Developers Sign In Dashboard

ServiceFeatureTable QML Type

A dataset from an individual layer or table in an ArcGIS map service or feature service. More...

Import Statement: import Esri.ArcGISRuntime 100.9
Since: Esri.ArcGISRuntime 100.0
Inherits:

ArcGISFeatureTable

Properties

Signals

Methods

Detailed Description

The feature service may be hosted in the cloud on ArcGIS Online, or on-premises on ArcGIS Server. The data is retrieved from the service as needed and stored in a mobile geodatabase on the local file system. How data is retrieved depends on the Enums.FeatureRequestMode.

When using a feature service, you can potentially create, delete, and update the data depending upon whether the service allows those operations, who owns the data, and what ownership-based access control policies are in place. Use the methods canAdd(), canUpdate(), canDelete(), and canEditGeometry() to determine what operations are permitted.

A ServiceFeatureTable is typically used in conjunction with a FeatureLayer to display feature data on a map. It can handle temporary network outages while still allowing you to work with the data that has already been retrieved from the service. Your edits are immediately persisted to the mobile geodatabase and can be applied to the service later when network connectivity is restored. When used to create a FeatureLayer in a MapView, features are projected on the fly to match the spatial reference of the map.

If the table has relationships, you can get related tables, query for related features and edit them. You can also query the table based on SQL expressions and spatial relationships. If the service supports attachments, you can also view and potentially edit the attachments.

You can initialize the service feature table in several different ways: creating from a URL, creating for another service feature table and relationship info, or creating from portal item and layer ID. Note that the Portal Item and layer ID properties must be used together or not at all. Each method of initialization is mutually exclusive.

A ServiceFeatureTable has an Enums.FeatureRequestMode, which controls (1) whether features are cached locally (for quicker access by map and scene layers) and (2) whether queries are performed on the local cache or on the server. You can retrieve or modify a table's feature request mode using Enums.FeatureRequestMode.

If the table's mode is Enums.FeatureRequestModeOnInteractionCache, features are requested from the server in response to user or developer interaction (pan or zoom) and are cached locally. Queries are executed on the cache or (if requested features are not resident in the cache) on the server. This mode is the default.

If the table's mode is Enums.FeatureRequestModeOnInteractionNoCache, features are always requested from the server. Features are not cached, and all queries are executed on the server.

If the table's mode is Enums.FeatureRequestModeManualCache, you must call ServiceFeatureTable::populateFromService(), which populates the local table with the features specified by QueryParameters and containing the attributes specified by the parameter outFields. Features are cached for the duration of the session and queries are executed against the cache.

If the table's feature request mode is OnInteractionCache or OnInteractionNoCache, ArcGISFeatures in the table initially contain a minimum set of attributes and geometry that omits any m-values. This is an optimization for faster rendering. To access all attributes (and geometry with m-values) in features you get from a query, do one of the following:

When used to create a FeatureLayer in a MapView, features are requested from the services in the correct spatial reference to match the spatial reference of the map.

You can use a service feature table to access non-spatial tables from feature services where FeatureTable::hasGeometry is false. The feature request mode of the table must be Enums.FeatureRequestModeManualCache, and you must call ServiceFeatureTable::populateFromService().

The parent class definition allows a service feature table to have editable attribute fields, feature templates, feature types, and editing capabilities defined in ArcGISFeatureLayerInfo::capabilities. See FeatureTemplate and FeatureType.

A service feature table might require authentication to access the service.

ServiceFeatureTable adopts the loadable pattern; many of its properties are initialized asynchronously after connecting to the service. See Loadable for more information.

This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

TypeDefault Property
Credentialcredential
RequestConfigurationrequestConfiguration (since Esri.ArcGISRuntime 100.1)
ServiceFeatureTableinitRelatedTable (since Esri.ArcGISRuntime 100.1)
RelationshipInforelationshipInfo (since Esri.ArcGISRuntime 100.1)
ArcGISIteminitItem (since Esri.ArcGISRuntime 100.3)

See also Cancelable, Loadable, RemoteResource, and FeatureLayer.

Property Documentation

applyEditsResult : list<FeatureEditResult>

Returns the results of the applyEdits asynchronous task (read-only).


applyEditsStatus : Enums.TaskStatus

Returns the status of the applyEdits asynchronous task (read-only).

See also Enums.TaskStatus.


bufferFactor : double

The factor used to determine the size of the buffer around the map's current extent for which data is retrieved from the service.

The bufferFactor property only applies when to Enums.FeatureRequestModeOnInteractionCache.

Data is not retrieved again until either it expires or the map extent changes and is no longer located in the buffered extent. The buffer factor can be a value up to 10. If it is set to 0 or 1, then every time the map extent is changed, data for that extent will be requested from the service.

The Default value is 2.0.


[default] credential : Credential

The security credential used to access the feature service.

This is only applicable if the service is secured.


definitionExpression : string

The SQL statement where clause used to filter the features by attributes.

The definition expression string uses the SQL-92 WHERE clause syntax. Be sure to escape special characters in the expression string as required for your platform. The DATE keyword expects the date format yyyy-mm-dd and the TIMESTAMP keyword expects the time stamp format yyyy-mm-dd hh:mm:ss. See the ArcGIS Blog article Querying Feature Services Date-Time Queries for more information.

This property was introduced in Esri.ArcGISRuntime 100.2.


featureRequestMode : Enums.FeatureRequestMode

The mode used to retrieve features from the service.

The default value is Enums.FeatureRequestModeOnInteractionCache.

See also Enums.FeatureRequestMode.


geodatabaseVersion : string

The geodatabase version.


[default] initItem : ArcGISItem

The existing ArcGISItem used to create the table.

This property must be used in conjunction with the initLayerId property.

The Item must be a PortalItem and correspond to a map service or a feature service.

This property was introduced in Esri.ArcGISRuntime 100.3.


initLayerId : string

The layer ID of the service's layer to use to create the table.

This property must be used in conjunction with the initItem property.

Note: The underlying Runtime property is represented as a 64-bit integer type. See Accessing 64-bit integer properties from QML.

Note: initLayerId and initLayerIdAsInt can be used interchangeably. Both reference the same underlying Runtime property.

This property was introduced in Esri.ArcGISRuntime 100.3.

See also initLayerIdAsInt.


initLayerIdAsInt : int

The same as initLayerId but represented as an integer type (read-only).

Note: The underlying Runtime property is represented as a 64-bit integer type. See Accessing 64-bit integer properties from QML.

Note: initLayerIdAsInt and initLayerId can be used interchangeably. Both reference the same underlying Runtime property.

This property was introduced in Esri.ArcGISRuntime 100.3.


[default] initRelatedTable : ServiceFeatureTable

The table to relate to this table using relationshipInfo.

This property was introduced in Esri.ArcGISRuntime 100.1.


loadOrRefreshFeaturesStatus : Enums.TaskStatus

Returns the status of the loadOrRefreshFeatures asynchronous task (read-only).

This property was introduced in Esri.ArcGISRuntime 100.3.

See also Enums.TaskStatus.


populateFromServiceResult : list<FeatureQueryResult>

Returns the results of the populateFromService asynchronous task (read-only).


populateFromServiceStatus : Enums.TaskStatus

Returns the status of the populateFromService asynchronous task (read-only).

See also Enums.TaskStatus.


[default] relationshipInfo : RelationshipInfo

Description of the relationship between this table and the initRelatedTable.

This property was introduced in Esri.ArcGISRuntime 100.1.


[default] requestConfiguration : RequestConfiguration

The configuration parameters used for network requests sent by this task.

This property was introduced in Esri.ArcGISRuntime 100.1.


serviceGeodatabase : ServiceGeodatabase

The service geodatabase this service feature table is part of (read-only).

This property was introduced in Esri.ArcGISRuntime 100.9.


undoLocalEditsStatus : Enums.TaskStatus

Returns the status of the undoLocalEdits asynchronous task (read-only).

This property was introduced in Esri.ArcGISRuntime 100.3.

See also Enums.TaskStatus.


url : url

The url of an individual layer or table in an ArcGIS map service or feature service whose data needs to be accessed or edited.


Signal Documentation

applyEditsStatusChanged()

Emitted when the applyEditsStatus property changes.

Note: The corresponding handler is onApplyEditsStatusChanged.


bufferFactorChanged()

Emitted when the bufferFactor property changes.

Note: The corresponding handler is onBufferFactorChanged.


credentialChanged()

Emitted when the credential property changes.

Note: The corresponding handler is onCredentialChanged.


definitionExpressionChanged()

Emitted when the definitionExpression property changes.

Note: The corresponding handler is onDefinitionExpressionChanged.

This signal was introduced in Esri.ArcGISRuntime 100.2.


featureRequestModeChanged()

Emitted when the featureRequestMode property changes.

Note: The corresponding handler is onFeatureRequestModeChanged.


geodatabaseVersionChanged()

Emitted when the geodatabaseVersion property changes.

Note: The corresponding handler is onGeodatabaseVersionChanged.


initItemChanged()

Emitted when the initItem property changes.

Note: The corresponding handler is onInitItemChanged.

This signal was introduced in Esri.ArcGISRuntime 100.3.


initLayerIdAsIntChanged()

Emitted when the initLayerIdAsInt property changes.

Note: The corresponding handler is onInitLayerIdAsIntChanged.

This signal was introduced in Esri.ArcGISRuntime 100.3.


initLayerIdChanged()

Emitted when the initLayerId property changes.

Note: The corresponding handler is onInitLayerIdChanged.

This signal was introduced in Esri.ArcGISRuntime 100.3.


initRelatedTableChanged()

Emitted when the initRelatedTable property changes.

Note: The corresponding handler is onInitRelatedTableChanged.

This signal was introduced in Esri.ArcGISRuntime 100.1.


loadOrRefreshFeaturesStatusChanged()

Emitted when the loadOrRefreshFeaturesStatus property changes.

Note: The corresponding handler is onLoadOrRefreshFeaturesStatusChanged.

This signal was introduced in Esri.ArcGISRuntime 100.3.


populateFromServiceStatusChanged()

Emitted when the populateFromServiceStatus property changes.

Note: The corresponding handler is onPopulateFromServiceStatusChanged.


relationshipInfoChanged()

Emitted when the relationshipInfo property changes.

Note: The corresponding handler is onRelationshipInfoChanged.

This signal was introduced in Esri.ArcGISRuntime 100.1.


requestConfigurationChanged()

Emitted when the requestConfiguration property changes.

Note: The corresponding handler is onRequestConfigurationChanged.

This signal was introduced in Esri.ArcGISRuntime 100.1.


undoLocalEditsStatusChanged()

Emitted when the undoLocalEditsStatus property changes.

Note: The corresponding handler is onUndoLocalEditsStatusChanged.

This signal was introduced in Esri.ArcGISRuntime 100.3.


urlChanged()

Emitted when the url property changes.

Note: The corresponding handler is onUrlChanged.


Method Documentation

string applyEdits()

Applies the temporary edits in the mobile geodatabase to the service using an asynchronous task.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to applyEdits. You should check that the applyEditsStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal applyEditsStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the applyEdits task.

See also Enums.TaskStatus and Cancelable.


void clearCache(keepLocalEdits)

Clears all the data in the table, including any temporary edits. The keepLocalEdits is default to true.

If keepLocalEdits is true, then edited rows in the table won't be cleared.


string loadOrRefreshFeatures(features)

Loads all attributes and geometries for unloaded features, and refetches attributes and geometries for previously loaded features.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to loadOrRefreshFeatures. You can check that the loadOrRefreshFeaturesStatus property is not Enums.TaskStatusInProgress before calling this method.

Features you get from ServiceFeatureTable::queryFeaturesWithFieldOptions() or ServiceFeatureTable::queryRelatedFeaturesWithFieldOptions might be in the minimally loaded state (minimum attributes required for rendering and no m-values). To load all attributes, pass a mutable array of the features to this method.

After the task starts, you may use the signal loadOrRefreshFeaturesStatus to monitor task status.

After calling this method, any non-applied edits on the table will be lost.

  • features. The list of features to be loaded/refreshed. Any features requested but not returned by the server will have its OBJECTID cleared (set to an invalid negative value) to indicate it is no longer associated with the service feature table.

Note: This method will not refresh feature attachments. Use AttachmentListModel::fetchAttachments on each feature to retrieve attachments instead.

Note: After calling this method, any non-applied local edits on the table will be lost.

This method was introduced in Esri.ArcGISRuntime 100.3.

See also Enums.TaskStatus and Cancelable.


string populateFromService(parameters, bool clearCache, list<string> outFields)

Queries the feature service and places the resulting features in the local table, which is cached for the duration of the session.

Requests data from the service using specified query parameters, whether to clear the existing cache with clearCache and the specified outFields. The fetched data is added to the local copy of the table.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to populateFromService. You should check that the populateFromServiceStatus property is not Enums.TaskStatusInProgress before calling this method. After the task starts, you may use the signal populateFromServiceStatusChanged to monitor task status.

The ServiceFeatureTable must have its ServiceFeatureTable::featureRequestMode set to Enums.FeatureRequestModeManualCache.

This method is useful for non-geographic data. It's also helpful when you want to avoid accessing the service for a feature whose geometry is in the current extent of the map or scene.

Specifying null or an empty list for outFields results in the minimum set of fields being used when populating the local table. This is the same set of attributes described for Enums.FeatureRequestModeOnInteractionCache or Enums.FeatureRequestModeOnInteractionNoCache.

See also Enums.TaskStatus and Cancelable.


string queryFeaturesWithFieldOptions(parameters, Enums.QueryFeatureFields queryFeatureFields)

Queries features from this table's cache and/or from the feature service used to create this table.

  • parameters - Parameters that specify how to filter the query and return results.
  • queryFeatureFields - An Enums.QueryFeatureFields enumeration value indicating which fields to return from the query.

If the request mode of the table is Enums.FeatureRequestModeManualCache, then the query is always performed on the local table. If the mode is Enums.FeatureRequestModeOnInteractionCache, then the query is performed on the local cache, provided that the geometries of the features are within an extent that has been cached; otherwise, the query is performed on the server. If the mode is Enums.FeatureRequestModeOnInteractionNoCache, the query is always performed on the server.

The Enums.QueryFeatureFields control which fields will be included with the returned features.

  • A table whose feature request mode is Enums.FeatureRequestModeManualCache contains all fields that you specified when calling ServiceFeatureTable::populateFromService().
  • A table whose feature request mode is OnInteractionCache or OnInteractionNoCache initially contains features with a minimum set of attributes required for rendering. You must load a feature to access all its attributes. The enum Enums.QueryFeatureFieldsLoadAll automatically loads the returned features into the local table, which makes all attributes available.

    You can also query on any attribute defined by the feature service's table. If the attribute is not in the minimum set of attributes in your local table, the query will be performed on the server.

ServiceFeatureTable::queryFeaturesWithFieldOptions() may be run concurrently. The last result will always be stored in the queryFeaturesResult property. To keep track of concurrent tasks, the queryFeaturesResults property can be used to sort multiple results, mapped to the task ID of each task.

Returns a task ID that can be used to cancel the ServiceFeatureTable::queryFeaturesWithFieldOptions() task. The task ID is also used to locate the specific result in queryFeaturesResults for this task.

See also Cancelable.


string queryRelatedFeaturesWithFieldOptions(feature, RelatedQueryParameters relatedQueryParameters, Enums.QueryFeatureFields queryFeatureFields)

Queries for features related to the given feature using the given related query parameters and query feature fields.

  • feature - The feature whose related features are to be queried.
  • relatedQueryParameters - Parameters that specify how to filter the query and return results.
  • queryFeatureFields - An Enums.QueryFeatureFields enumeration value indicating which fields to return from the query.

Only returns results from tables that have been added to the map that this table is associated with.

The queryRelatedFeaturesStatusChanged signal emits when the operation is complete. Check the queryRelatedFeaturesStatus property to make sure the operation completed successfully. The results are then available through queryRelatedFeaturesResults.

This method was introduced in Esri.ArcGISRuntime 100.1.

See also Cancelable.


string undoLocalEdits()

Undoes all of the local edits since the last successful applyEdits.

All features that were added, updated, or deleted after the last successful applyEdits will revert back to their original state; thus, any in-memory features must be discarded in favor of a new query result. Returns a task ID that can be used to cancel the applyEdits task.

This method was introduced in Esri.ArcGISRuntime 100.3.

See also Enums.TaskStatus and Cancelable.



Feedback on this topic?