ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Reports Namespace / Report Class / SetDefinitionQuery Method / SetDefinitionQuery(String) Method
Definition query of the report.
Example

In This Topic
    SetDefinitionQuery(String) Method
    In This Topic
    Updates the definition query of the report. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Sub SetDefinitionQuery( _
       ByVal defQuery As String _
    ) 
    public void SetDefinitionQuery( 
       string defQuery
    )

    Parameters

    defQuery
    Definition query of the report.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Modify the Report DefinitionQuery
    {
      //Note: Call within QueuedTask.Run()
      //Remove Groups
      // The fields in the datasource used for the report
      var listFields = new List<string> {
           "STATE_NAME"
          };
      report.RemoveGroups(listFields);
    
      //Add Group
      report.AddGroup("STATE_NAME", true, true, "");
    
      //Modify the Definition Query
      var defQuery = "STATE_NAME LIKE 'C%'";
      report.SetDefinitionQuery(defQuery);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also