Question

I need to find TFS work items related to a certain topic in our project. For that purpose, I tried querying the work items using the query builder in Visual Studio.

Since there are multiple terms I wish to search for, I imagined a query like this:

WHERE (
Priority > 300 AND 
(Title.Contains('Dog') OR Title.Contains('Cat') OR Title.Contains('Hamster')))

Now, according to http://msdn.microsoft.com/en-us/library/dd286638.aspx (Section And/Or) one should be able to do that like so:

    | Priority|   >    | 300
And | Title | Contains | Dog
Or  | Title | Contains | Cat
Or  | Title | Contains | Hamster

But... that does not work as described: as far as I can see, this is treated like

(Priority > 300 AND Title.Contains('Dog')) OR Title.Contains('Cat') OR Title.Contains('Hamster')))

Now that is a bit of a problem for me, because apart from a 'Priority' criterion I also have 8 additional criteria that need to apply to all the matches (Date, State, etc.). And I have not only three possible title matches, but around ten. So that multiplies and I would end up with a query that is terribly long and mostly redundant.

.. or, am I missing something here? Is there another way to express those statements? Or is there even another way to query TFS work items, like another tool?

Thanks!

Était-ce utile?

La solution

You need to "Group" your Title clauses together to get the query you expect. Select the three "Title" clauses, Right Click and select "Group Clauses".

Group Clauses

Here's a snip of a query I created in VS2012 to do this, but it's the same in 2010.

It will only find work items with a Priority >4 and a Title containing either Crash, Error or Working.

Query with Grouped Clauses

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top