Skip To Content ArcGIS for Developers Sign In Dashboard

ServiceFeatureTable Class

(Esri::ArcGISRuntime::ServiceFeatureTable)

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

Header: #include <ServiceFeatureTable>
Since: Esri::ArcGISRuntime 100.0
Inherits: ArcGISFeatureTable and RemoteResource

Public Functions

ServiceFeatureTable(const QUrl &url, QObject *parent = nullptr)
ServiceFeatureTable(ServiceFeatureTable *table, const RelationshipInfo &relationshipInfo, QObject *parent = nullptr)
ServiceFeatureTable(const QUrl &url, Credential *credential, QObject *parent = nullptr)
ServiceFeatureTable(Item *item, qint64 layerId, QObject *parent = nullptr)
~ServiceFeatureTable()
TaskWatcher applyEdits()
double bufferFactor() const
void clearCache(bool keepLocalEdits = true)
QString definitionExpression() const
FeatureRequestMode featureRequestMode() const
QString geodatabaseVersion() const
TaskWatcher loadOrRefreshFeatures(const QList<Feature *> &features)
TaskWatcher populateFromService(const QueryParameters &parameters, bool clearCache, const QStringList &outFields)
TaskWatcher queryFeatures(const QueryParameters &parameters, QueryFeatureFields queryFeatureFields)
TaskWatcher queryRelatedFeatures(ArcGISFeature *originFeature, const RelatedQueryParameters &relatedQueryParameters, QueryFeatureFields queryFeatureFields)
void setBufferFactor(double buffer)
void setDefinitionExpression(const QString &expression)
void setFeatureRequestMode(FeatureRequestMode mode)
void setGeodatabaseVersion(const QString &version)
TaskWatcher undoLocalEdits()

Reimplemented Public Functions

virtual Credential *credential() const
virtual RequestConfiguration requestConfiguration() const
virtual void setRequestConfiguration(const RequestConfiguration &requestConfiguration)
virtual QUrl url() const

Signals

void applyEditsCompleted(QUuid taskId, const QList<Esri::ArcGISRuntime::FeatureEditResult *> &featureEditResults)
void loadOrRefreshFeaturesCompleted(QUuid taskId)
void populateFromServiceCompleted(QUuid taskId, Esri::ArcGISRuntime::FeatureQueryResult *featureQueryResult)
void undoLocalEditsCompleted(QUuid taskId)

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

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

The 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 featureRequestMode().

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

If the service supports attachments, hasAttachments(), you can also view and potentially edit the attachments.

You can also query the data based on SQL expressions and/or spatial relationships.

This class is typically used in conjunction with a FeatureLayer to display feature data on a map, but it can also be a non-spatial table. 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.

If the table has relationships, you can get related tables and query for related features and edit them.

When used to create a FeatureLayer in a MapView, features are projected on the fly to match the spatial reference of the map.

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

See also FeatureLayer.

Member Function Documentation

ServiceFeatureTable::ServiceFeatureTable(const QUrl &url, QObject *parent = nullptr)

Constructs a service feature table from a specified url and an optional parent.

ServiceFeatureTable::ServiceFeatureTable(ServiceFeatureTable *table, const RelationshipInfo &relationshipInfo, QObject *parent = nullptr)

Constructs a new ServiceFeatureTable from an existing ServiceFeatureTable and a given RelationshipInfo.

This function was introduced in Esri::ArcGISRuntime 100.1.

ServiceFeatureTable::ServiceFeatureTable(const QUrl &url, Credential *credential, QObject *parent = nullptr)

Constructs a service feature table from a specified url, credential and an optional parent.

ServiceFeatureTable::ServiceFeatureTable(Item *item, qint64 layerId, QObject *parent = nullptr)

Constructs a service feature table from a specified item.

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

  • item - An existing Item to use to create the table.
  • layerId - The layer ID of the service's layer to use to create the table.
  • parent - The parent object (optional).

This function was introduced in Esri::ArcGISRuntime 100.3.

ServiceFeatureTable::~ServiceFeatureTable()

Destructor.

TaskWatcher ServiceFeatureTable::applyEdits()

Applies the temporary edits in the mobile geodatabase to the service.

Applies edits to attributes, geometry, and attachments.

Returns a TaskWatcher for the asynchronous operation.

[signal] void ServiceFeatureTable::applyEditsCompleted(QUuid taskId, const QList<Esri::ArcGISRuntime::FeatureEditResult *> &featureEditResults)

Signal emitted when the table has finished applying edits back to the service.

  • taskId - The task ID for the asynchronous operation.
  • featureEditResults - The edit results indicating if any errors occurred when applying edits back to the service.

The returned FeatureEditResult objects have the ServiceFeatureTable as their parent.

See also Returned QObjects Parenting.

double ServiceFeatureTable::bufferFactor() const

Returns 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 to FeatureRequestMode::OnInteractionCache

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, every time the map extent is changed, data for that extent will be requested from the service.

The default value is 2.0.

See also setBufferFactor().

void ServiceFeatureTable::clearCache(bool keepLocalEdits = true)

Clears all the data in the table, including any temporary edits.

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

[virtual] Credential *ServiceFeatureTable::credential() const

Reimplemented from RemoteResource::credential().

Returns the security credential used to access the feature service.

Only applicable if the service is secured.

QString ServiceFeatureTable::definitionExpression() const

Returns the expression used for filtering features queried in this table.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also setDefinitionExpression().

FeatureRequestMode ServiceFeatureTable::featureRequestMode() const

Returns the mode on how data should be retrieved from the service.

The default value is FeatureRequestMode::OnInteractionCache.

See also setFeatureRequestMode().

QString ServiceFeatureTable::geodatabaseVersion() const

Returns the geodatabase version.

See also setGeodatabaseVersion().

TaskWatcher ServiceFeatureTable::loadOrRefreshFeatures(const QList<Feature *> &features)

Loads all attributes and geometry for unloaded features, or refetches attributes and geometry from already-loaded features.

Returns a TaskWatcher for the asynchronous operation. Connect to the loadOrRefreshFeaturesCompleted signal to know when the task completes.

features. The list of features to be loaded/refreshed. Any features which were not returned by the service will have their OBJECTID cleared to indicate they are no longer associated with the 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 function was introduced in Esri::ArcGISRuntime 100.3.

[signal] void ServiceFeatureTable::loadOrRefreshFeaturesCompleted(QUuid taskId)

Signal emitted when the load or refresh features task has completed. with data acquired from the service.

  • taskId - The task ID for the asynchronous operation.

This function was introduced in Esri::ArcGISRuntime 100.3.

TaskWatcher ServiceFeatureTable::populateFromService(const QueryParameters &parameters, bool clearCache, const QStringList &outFields)

Queries data from the service to populate the table using an asynchronous task.

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 returns a TaskWatcher for the asynchronous operation.

This operation is especially important for non-geographic data or when featureRequestMode() is FeatureRequestMode::ManualCache because the data is not requested automatically based on the map's extent.

[signal] void ServiceFeatureTable::populateFromServiceCompleted(QUuid taskId, Esri::ArcGISRuntime::FeatureQueryResult *featureQueryResult)

Signal emitted when the table has finished populating with data acquired from the service.

  • taskId - The task ID for the asynchronous operation.
  • featureQueryResult - A result of features that satisfied the query and have been added to the table.

The returned FeatureQueryResult objects have the ServiceFeatureTable as their parent.

See also Returned QObjects Parenting.

TaskWatcher ServiceFeatureTable::queryFeatures(const QueryParameters &parameters, QueryFeatureFields queryFeatureFields)

Queries for features in this FeatureTable using the provided QueryParameters and QueryFeatureFields.

  • parameters - The query parameters.
  • queryFeatureFields - An enumeration indicating which fields to return from the query.

Returns a TaskWatcher for the asynchronous task.

TaskWatcher ServiceFeatureTable::queryRelatedFeatures(ArcGISFeature *originFeature, const RelatedQueryParameters &relatedQueryParameters, QueryFeatureFields queryFeatureFields)

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

  • originFeature - The feature whose related features are to be queried.
  • relatedQueryParameters - The related query parameters.
  • queryFeatureFields - An enumeration indicating which fields to return from the query.

Returns a TaskWatcher for the asynchronous task.

This function was introduced in Esri::ArcGISRuntime 100.1.

[virtual] RequestConfiguration ServiceFeatureTable::requestConfiguration() const

Reimplemented from RemoteResource::requestConfiguration().

Returns the RequestConfiguration in use by this ServiceFeatureTable.

This function was introduced in Esri::ArcGISRuntime 100.1.

See also setRequestConfiguration().

void ServiceFeatureTable::setBufferFactor(double buffer)

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

See also bufferFactor.

void ServiceFeatureTable::setDefinitionExpression(const QString &expression)

Sets an expression which is a SQL statement where clause to filter out the features to be queried.

  • expression. The where clause expression.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also definitionExpression().

void ServiceFeatureTable::setFeatureRequestMode(FeatureRequestMode mode)

Sets the mode on how data should be retrieved from the service.

The default is FeatureRequestMode::OnInteractionCache.

You cannot change the feature request mode after the table is successfully loaded.

See also featureRequestMode().

void ServiceFeatureTable::setGeodatabaseVersion(const QString &version)

Sets the geodatabase version to version.

See also geodatabaseVersion().

[virtual] void ServiceFeatureTable::setRequestConfiguration(const RequestConfiguration &requestConfiguration)

Reimplemented from RemoteResource::setRequestConfiguration().

Sets configuration parameters used for network requests sent by this ServiceFeatureTable to requestConfiguration.

This function was introduced in Esri::ArcGISRuntime 100.1.

See also requestConfiguration().

TaskWatcher ServiceFeatureTable::undoLocalEdits()

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

All features that were added, updated, or deleted after the last successfully completed applyEdits will revert back to their original state; thus, any in-memory feature(s) must be discarded in favor of a new query result.

Returns a TaskWatcher for the asynchronous task.

This function was introduced in Esri::ArcGISRuntime 100.3.

[signal] void ServiceFeatureTable::undoLocalEditsCompleted(QUuid taskId)

Signal emitted when all local edits since the last time applyEdits was called, are reverted.

  • taskId - The task ID for the asynchronous operation.

[virtual] QUrl ServiceFeatureTable::url() const

Reimplemented from RemoteResource::url().

Returns the URL of an individual layer or table in an ArcGIS map or feature service whose data needs to be accessed or edited.


Feedback on this topic?