ArcGIS Pro 3.4 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.
    Syntax
    public DefinitionQuery SetDefinitionQuery( 
       string whereClause
    )
    Public Function SetDefinitionQuery( _
       ByVal whereClause As String _
    ) As DefinitionQuery

    Parameters

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

    Return Value

    A DefinitionQuery object.
    Exceptions
    ExceptionDescription
    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.
    Remarks
    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 deactivate any existing definition query.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also