简体   繁体   English

Visual Studio:查询TFS工作项:AND / OR逻辑不起作用?

[英]Visual Studio: Query TFS Work Items: AND/OR Logic doesn't work?

I need to find TFS work items related to a certain topic in our project. 我需要找到与项目中某个主题相关的TFS工作项。 For that purpose, I tried querying the work items using the query builder in Visual Studio. 为此,我尝试使用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: 现在,根据http://msdn.microsoft.com/en-us/library/dd286638.aspx(Section And / Or ),应该可以这样做:

    | 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'))) (优先级> 300 AND Title.Contains('Dog'))或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.). 现在这对我来说有点问题,因为除了“优先级”标准之外,我还有8个额外的标准需要应用于所有匹配(日期,状态等)。 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? 或者是否有另一种方法来查询TFS工作项,比如另一种工具?

Thanks! 谢谢!

You need to "Group" your Title clauses together to get the query you expect. 您需要将Title子句“分组”在一起以获得您期望的查询。 Select the three "Title" clauses, Right Click and select "Group Clauses". 选择三个“标题”子句,右键单击并选择“组子句”。

小组条款

Here's a snip of a query I created in VS2012 to do this, but it's the same in 2010. 这是我在VS2012中创建的查询的剪辑,但是在2010年它是相同的。

It will only find work items with a Priority >4 and a Title containing either Crash , Error or Working . 它只会找到一个优先工作项目>4 含有无论是标题CrashErrorWorking

使用分组子句查询

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM