Feature service GetCount method

Gets the number of rows that will be returned by the query.

int GetCount(int LayerOrTableID, string DefinitionExpression, QueryFilter QueryFilter, string VersionName)




The ID of the layer or table from which to delete features or objects.


A type's definition expression.


Describes the features or objects to delete based on attribute expressions, time and/or spatial filters.


Geodatabase version to query. This parameter applies only to feature services that expose geodatabases. If not specified, queries are made against the published map's version.

Return Value

GetCount returns an integer value representing the count of features or objects that meet the QueryFilter criteria and definition expression.


If a layer or table is of interest, keep the definition expression as empty. If a type is of interest, use the type property's field name and TypeID value in the definition expression.

Definition expressions are separate from and can be applied in addition to QueryFilters. Definition expressions can be used to apply queries to a specific type within a layer or table. You can also use a definition expression to easily apply the same query to all layers in the service.