TFS 2010 Work Items Basic User Guide – Create And Use Queries

ינואר 7, 2010

This post is the Forth post out of Five that builds the TFS 2010 Work Items Basic Guide. See the first post: “TFS 2010 Work Items Basic User Guide – Introduction”


I have already published posts regarding the creation of new Work Items: “TFS 2010 Work Items Basic User Guide – Create New Work Items” and about the Work Item Links: “TFS 2010 Work Items Basic User Guide – Work Item Link Types”


On this post I will talk about Queries.


In order to see the Work Items you have entered to the Team System you will need to create a "Search", the way you search the Team System is by Queries.


Queries contains filters, you can put filters on each of the Work Item fields.


There Are two groups of queries:



  • Team Queries – These queries are available to the entire group and are created and modified by the Project Administrator.

  • My Queries – These are personal queries that will be available to me only and are created and modified by the user.

types 


In order to create a query do the following:


Step 1: Right Click the "Work Item" folder in the Team Explorer and choose "New Query"


New_Query_Step_1


There are 3 types of queries:



  1. Flat List (Default) – A query that is based on Work Items only without any filter on the linked Work Items. (First Level Only)

  2. Work Items and Direct Links – A query that is based on all the filters of the Flat List, Filters on the Linked Work Item Type and Filters on the Link Types.

  3. Tree of Work Items – A query that is based on all the filters of the Flat List and on the Linked Work Item Type where the link type are Parent/Chilled.

Query_Types_Step_1


For the “Flat List” there are two sections in the Query editor window:



  1. Filters Section – Where you can add filters to your query, filters can be added to every field exist in you work item type.

  2. Results Section – Where you will see the results of the query you build.

Flat_List_Sections


For the “Work Items and Direct Link” there are four sections in the Query editor window:



  1. Filters On Work Items Section – Where you can add filters to your query, filters can be added to every field exist in you work item type.

  2. Filters On Work Item Types (Linked) – Where you can add filters on the linked work items by there Work Item Type.

  3. Filters On Link Types – Where you can add filters by the link type.

  4. Results Section – Where you will see the results of the query you build.

Work_Items_and_Direct_Link


For the “Tree of Work Items” there are three sections in the Query editor window:



  1. Filters On Work Items Section – Where you can add filters to your query, filters can be added to every field exist in you work item type.

  2. Filters On Work Item Types (Linked) – Where you can add filters on the linked work items by there Work Item Type.

  3. Results Section – Where you will see the results of the query you build.

Note: The link type that will be shown is of type Parent/Chilled


Tree_of_Work_Items 


Step 2: Choose the Query type you like to build.


Step 3A: No matter what type of query you choose to build you will need to start by adding filters to the query, in case you like to see all the Work Items that are in the system don't add any filters just run the query with the default Team Project filter.


For this example I have added the "Assigned To" filter, I have set it to be "@Me".


Note: The default filter just set the Team Project contexts of the query, @Project means the project I am in now and @Me for the Assigned To field means assigned to my user name.


Choosing_filter_step_1


Choose_filter_value_step_2 


If you use the “Flat List” go to step 4


Step 3B: If you use the “Work Items and Direct Link” or the “Tree of Work Items” you will now need to add filters for the linked work item types, just add Work Item Types to the “Filters On Work Item Types (Linked)” section.


In my example I have added “Test Case” as filter, you can add as many as you need.


Adding_Test_Case_Filter


If you use the “Tree of Work Items” go to step 4


Step 3C: If you use the “Work Items and Direct Link” you will now need to add filters for the link types, to do that you will choose the “Top level work items” radio button and use the check boxes of the “Types of links:” to control the returned linked items.


In my example I have chosen “Tested By” as filter, you can choose more than 1.


Links_types


Step 4: When you have finished setting the filters run the query to see if you get the results you need, click the "Run" button from the menu.


Run_button


results


You get a list of work items that answers the filters you have just set, see that the linked work items that where returned are from type “Test Case” and the link type is “Tested By”.


Step 5: By default you get the “Link Type”, “Work Item Type”, “Title”, “Assigned To” and “State” columns in the results window, in order to change that just click “Columns Options” button and choose the columns that you like to see and there order.


choose_columns 


Step 5: From the left hand side choose each of the fields you like to see in the results window and pass them to the right hand side of the window, you can also choose their locations by using the arrow buttons located next to the left hand side of the window and you can also control their default width by changing the value in the text box under the arrow buttons.


Add_Priority


I have chosen to see the “Priority" in this example the result is the "Priority" column.


Priority_in_the_results


Step 6: When ready save the query by clicking the "Save Query" button.


Save_Button


The save window gives 2 save options:



  1. Server – You can save to the “Team Queries” or to the “My Queries” you choose that by clicking the 3 dots and choose the folder from the window that pops up.

  2. File – When you will like to pass a query to other team members you can use this option to export a query.

Save_options_1


choose_folder_to_save 


Now that you have a saved query you can do three things:



  1. Run the query – Double click the query.

  2. Delete the query – Right click the query and choose "Delete".

  3. Edit the query Follow these steps:

Step 1: Right click the query and choose "Edit Query".


Edit_Query_1


Step 2: Make changes



Step 3: Save changes


Save_Button


As you can see, managing queries is very simple and intuitive.


Now that you know how to create and manage queries you can get to the information stored in the TFS in an easy and comfortable way.


Next Guide Part: "TFS 2010 Work Items Basic User Guide – Create New Work Items Out Of An Existing Work Items"


Have Fun!!!

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *

4 תגובות

  1. prafulספטמבר 30, 2010 ב 7:03

    how to find items from source control which are chnaged 30 days before ?

    הגב
  2. Eran Rusoאוקטובר 4, 2010 ב 23:51

    Hi Praful,

    Quering files is done in the changesets and Source Control section of TFS and not with the Work Items Queries

    Have Fun!!!

    הגב
  3. Arshadדצמבר 1, 2010 ב 19:57

    I have VSTS 2010 ultimate installed, but i am unable to see the "types of query" dropdown on the toolbar for query editor. Is there any step that i need to do to get this in my menubar or is this feature didnt make it to production?

    Thank you

    הגב
  4. Eran Rusoדצמבר 14, 2010 ב 8:38

    Hi Arshad,

    The common mistake here is installing the VS 2010 and running the VS 2008.

    This is a basic functionality of the Team Explorer 2010 that is installed automatically with the Visual Studio 2010.

    Have Fun!!!

    הגב