ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / BasicFeatureLayer Class / SetDefinitionQuery Method
A where clause that conforms to SQL standard to filter records.

In This Topic
    SetDefinitionQuery Method (BasicFeatureLayer)
    In This Topic
    Sets the where clause of the active definition query. This method must be called on the MCT. Use QueuedTask.Run.
    public DefinitionQuery SetDefinitionQuery( 
       string whereClause
    Public Function SetDefinitionQuery( _
       ByVal whereClause As String _
    ) As DefinitionQuery


    A where clause that conforms to SQL standard to filter records.

    Return Value

    A DefinitionQuery object.
    This method cannot be called if the feature layer is a member of SubtypeGroupLayer. Use the IsSubtypeLayer property to determine if the feature layer is a member of a SubtypeGroupLayer.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    If the whereClause is null or empty string, then the active query definition is removed and the layer no longer has an active definition query.Where there is an active definition query, this function updates the where clause of tha definition query with the whereClause you pass in.If the whereClause is non-null, and there is no active definition query, a new definition query with the specified where clause is created and becomes the active definition query. An auto generated name gets assigned. All other definition queries that are not active remain unchanged.Use SetActiveDefinitionQuery to activate or deactive any existing definition query.

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also