This document is archived and information here might be outdated.  Recommended version.


IMapServer3.QueryFeatureIDs Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Carto)  

IMapServer3.QueryFeatureIDs Method

Returns the IDs of the features that meet the query filter selection criteria for the specified layer.

[Visual Basic .NET]
Public Function QueryFeatureIDs ( _
    ByVal MapName As String, _
    ByVal LayerID As Integer, _
    ByVal Filter As IQueryFilter _
) As IFIDSet
[C#]
public IFIDSet QueryFeatureIDs (
    string MapName,
    int LayerID,
    IQueryFilter Filter
);
[C++]
HRESULT QueryFeatureIDs(
  BSTR MapName,
  long LayerID,
  IQueryFilter* Filter
);
[C++]

Parameters MapName [in]
MapName is a parameter of type BSTR LayerID [in]
LayerID is a parameter of type long Filter [in]
Filter is a parameter of type IQueryFilter*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

QueryFeatureIDs returns the IDs (FIDSet) of map features that match the parameters of a given query filter. FIDSet is always a sorted list of integers, therefore ORDER BY has no effects. Use QueryRowIDs if the result needs to be sorted by fields other than ObjectID field.

QueryFeatureIDs requires a number of input parameters. These include: a MapName, LayerID, and a QueryFilter. The QueryFilter can be an attribute query (SQL espression), a spatial query, or a combination of both.

QueryFilter 

QueryFilter provides the ability to query based on attribute filter (SQL expression) a spatial filter, or a combination of both. Attribute filters take any valid �non-GIS data specific� SQL statement. For example, CNTRY_CODE=�BD� or POPULATION=12345. Syntax for querying date fields depend on the underlying data. If you are working with Shapefile or File GeoDatabase data the syntax is <FieldName>=date �YYYY-MM-DD�; for Access-based Personal GeoDatabase the sytax is #YYYY-MM-DD#. For SDE database, check with the specific database�s help.

SearchShape 

Geometry set in ISpatialFilter should meet the following criteria:

Miscellaneous

MaxRecordCount does not affect QueryFeatureIDs or QueryFeatureIDs2.

There are two key differences between Find and QueryFeatureIDs. The first is that Find can work on multiple layers while the query methods work with a single layer. The second is that Find only works with a search string. The query methods use a queryFilter as a parameter. This allows the query to be based on either an attribute filter (SQL expression) or a spatial filter.

The results of this function can be used with LayerDescription::SelectionFeatures to display the selection in the exported image.

See Also

IMapServer3 Interface