How to return only top level items in TFS query

1.6k Views Asked by At

Using the TFS web interface, I need to compose a query that will return all of the Features in which any User Story or Bug has the Release field set to a particular release, which I can do (see the screen shot) but the trick is: how do I return ONLY the Features and not the child work items as well?

enter image description here

I have tried various permutations of this query to get the results I want. For example, I tired selecting "Return selected link type = Parent" but this had zero effect on the results returned. Any ideas?

After having struggled with this for quite a while I am forced to conclude that this is a failing in TFS. There is no way to return only top level results when the query depends on properties of the linked PBI's.

2

There are 2 best solutions below

0
On BEST ANSWER

As pointed out by starain-MSFT and Andy-MSFT in comments above, it is not possible to generate a query which returns ONLY top level items based on conditions within the children of those top level items in the web interface alone, which is what I needed. It is apparently possible to pull a query using a REST API but then, you would not be able to build a dashboard widget using the parsed results.

5
On

Just try to set the query as below:

Type of query : Work items and direct links

Filters for top level work items:

    Work item type = Feature 
And Area Path Under ADSuite\

Filters for linked work items :

    Work item type in User Story, Bug 
And RELEASE <> Release 07   #or RELEASE Not Under Release 07

Filter options

Only return items that do not have matching links

Types of links

Return links of any type

We can only use the opposite condition to list the features without child work items. We need to list all the opposite conditions... But seems it's difficult to set the condition combination. In my opinion, if you just need to query out the features, you can export the query result (which with the child work items) to excel, them filter out the features. That should be an easy way.

enter image description here