How to: Group or Ungroup Work Item Query Clauses

Query clauses can be grouped to operate as a single unit separate from the rest of the query, similar to putting parentheses around an expression in a mathematical equation or logic statement. When you group clauses, the AND or OR for the first clause in the group applies to the entire group.

Required Permissions

To perform these procedures, you must be a member of the Readers group or have the View work items in this node permission set to Allow. To save a query as a team query, you must be a member of the Project Administrators group. For more information, see Team Foundation Server Permissions.

To group work item query clauses

  1. Right-click the query you want to edit from the Team Queries or My Queries folders, and select View Query.

  2. In the query, select the query clauses that you want to combine into a group by clicking the left-most cell in the rows. Press CTRL and click to select multiple rows.

  3. Right-click the selected clauses, and then click Group Clauses.

    A bracket appears in the left margin of the query showing that the clauses are grouped.

  4. Save the query.

To ungroup work item query clauses

  1. Right-click the query you want to edit from the Team Queries or My Queries folders, and select View Query.

  2. In the query, select the entire grouped query clauses that you want to ungroup by clicking the left-most cell in the rows. Press CTRL and click to select multiple rows.

  3. Right-click the group, and then click Ungroup Clauses.

    The bracket is removed from the left margin of the Query Builder and the clauses are ungrouped.

    Note

    If Ungroup Clauses is unavailable, you have not selected all the clauses in the query grouping. Select all the clauses and try again.

  4. Save the query.

See Also

Tasks

How to: Save Work Item Queries
How to: Add or Remove Work Item Query Clauses
How to: Add New Work Item Queries
How to: Run Work Item Queries

Other Resources

Working With Work Item Query Clauses