let us learn how to create Queries. Queries are used to filter work items based on certain criteria. We can create queries from the web portal or from a supported client, such as Visual Studio Team Explorer and Team Explorer, save queries and share queries with others.
So, lets see how to create a Query.
- We can create a query by defining one or more clauses. For each clause we must choose Field, Operator and Value. To write custom Queries, click on New Query.
Query Types:
In Azure DevOps we have Three types of Query.
Example 1 (Flat list of work items): To view all the work items and the state of the work item.
- If we give work item type=[Any]; state=[Any] it will fetch all the results irrespective of Type and State.
- If we give field as Assigned to, either we can specify the name of the team member OR we can use @Me. The advantage of using @Me is, when we share this query with my team members, whoever runs this query, it will run against their name. like, if I run this query it will run against my name. If someone else runs this query, it will run against their name.
Explore more on this from https://docs.microsoft.com/en-us/azure/devops/boards/queries/query-operators-variables?view=azure-devops
Example 2: Imagine If you want to see the state of the work items that are Resolved and closed. Then, you can apply the following clause.
Save Queries:
We can save the queries under My Queries or Shared Queries. If you save your query under My queries, only you can view and run the query. Whereas, Shared queries can be viewed by everyone who has access to the project. You can give the name and save it under Shared queries or My queries.
Example 3 (Tree of work items): Now we will see How to run query for Tree of work items.
Here, firstly select Tree of work items and the specify the fields, ID is a Unique Identifier that is Assigned to work item. To view the Hierarchy of the work items and to view the parent child relationship, select parent/child. Finally run the Query. It will show everything under the Epic.
You can run number of queries to filter your work items by applying clauses. It is that easy!!
Query charts:
Charts are Query based status derived from a work item query. We can create charts from the Queries. We cannot create charts for Tree of work items and Direct links. Charts can be created from Flat-list queries.
- Let us create a Chart for Flat list work items
- Click on Charts ==> New Chart.
- Here, you can select the type of chart like pie, Bar, Column. Then we can Group it by state, assigned to, Work item types.
Pin charts to the Dashboard.
Dashboards are customizable signboards that provide real-time information. Dashboards are associated with a team or a project and display configurable charts.
- If you create charts out of Shared queries, you can pin these charts to the Dashboard. Click on Add to Dashboard.
- To view this chart in Dashboard. Go to Overview, click on Dashboard. We can see the chart that we pinned to the dashboard are available here.
- Similarly, we can also add different widgets to the Dashboard. Widgets display configural information and charts on dashboards. To add a widget, click on Edit. There you will find a lot of widgets you can just drag and drop it.
- Here we have selected Query Results as a widget, and then click on Done Editing.
- Now, click on the Query results widget.
- Here, specify which query result you want to see and then Click on save.
- And view your Query results.
Like this you can create charts and pin it to Dashboard and create widgets in the Dashboard.