Construct queries graphically

Every view in the Work Items topic contains the Query Builder in the toolbar or header. You construct queries by visually adding query elements to the Visual Query Builder. Query elements visually represent parameters of the underlying command-line syntax.

When you enter the Work Items topic, one default query element is shown in the Visual Query Builder: Unresolved. This element, alone, retrieves all unresolved Work Items. To get the results you want, you can either keep this element and add more to refine the results, or remove it and start adding different elements.

  • Click the inside a query element to remove it.

  • Click the in the query builder to add a query element.

When you click to add an element, a pop-up bubble shows you three lists: often-queried fields (Favorites), recently queried fields (recent), and all fields, including custom fields. Fields are listed by name, so you do not need to remember or use field IDs as you must for command-line queries.

Actions

Add element

Saved queries

Work Item Table view

Element list

Clear all

Query elements

Select field

Remove element

Select field values

Tips and tricks

  • You can clear all visual query elements or command-line text from the Visual Query Builder by clicking the X icon near the right-hand end of the tool.

  • Close element pop-up bubbles by clicking anywhere outside them.

  • If there are many visual query elements and some are scrolled out of view and/or condensed, you can see the condensed names and/or access and edit them using the list of all current elements. To display the list, click the drop-down arrow on the left side of the query builder. You can also use the list to remove any query element from the Query Builder.

  • The Recent section in the query element pop-up displays a list of the fields and field values you selected most recently. The items in this list can help you create often-needed queries and eliminate the need to save them.

  • You can convert any graphically constructed query to command-line text by clicking the drop-down arrow at the right-hand end of the query builder and selecting the Convert To Text option. This lets you build queries visually and copy the syntax to use it elsewhere, for example, in the Query parameter of a LiveReport Widget.

  • You can use the Query Builder in command-line mode by removing all graphical query elements and typing in valid command-line query syntax.

  • You can use both visual query elements and command-line text in the query builder. See Combine Text with Visual Queries.

  • The URL displayed in your browser contains a parameter query, which contains the full command-line syntax of the current query in the Query Builder. You can copy this parameter and use it in the query parameter of LiveReport Widgets or other places where Lucene query syntax is required.

  • The Visual Query Builder contains an element SQL, which can be used alone to filter the Work Items table by an SQL query only, or in conjunction with other visual query elements. For more information, see Use SQL Queries to Retrieve Work Items.

See also Advanced Work Item Querying.