我需要以一种使用非常有限的 WIQL 似乎无法实现的方式自定义工作项查询。我有一个相当标准的查询,需要稍微改变:
<?xml version="1.0" encoding="utf-8"?><WorkItemQuery Version="1">
<TeamFoundationServer>http ://blah-
blah01:8080/tfs/blahcollection</TeamFoundationServer>
<TeamProject>Blah</TeamProject><Wiql>
SELECT
[Microsoft.VSTS.Common.Priority],[System.AreaPath],
[Microsoft.VSTS.Common.Severity],[System.CreatedDate],[System.Id],
[System.WorkItemType],[System.Title],[System.CreatedBy],[System.State],
[System.AssignedTo],[System.ChangedDate],[BLAH.Category],[System.AreaId]
FROM WorkItems
WHERE [System.TeamProject] = @project
and [System.WorkItemType] <> ''
and [System.CreatedDate] >= '2012-01-27T00:00:00.0000000'
and [System.CreatedBy] <> 'blah'
and not [System.State] contains 'Tested'
and not [System.State] contains 'Released'
and [System.State] <> 'Developed'
and ([System.State] <> 'Closed'
and not [System.State] contains 'Resolved')
and [System.AssignedTo] in ('blah1', 'blah2', 'blah3')
ORDER BY
[System.WorkItemType],
[Microsoft.VSTS.Common.Priority],
[System.AreaPath],
[Microsoft.VSTS.Common.Severity],
[System.Id] desc,
[System.AssignedTo]
</Wiql></WorkItemQuery>
它应该返回与现在完全相同的结果,除了在 [System.AreaPath] 列中,应该首先出现包含“Foo”的项目,然后应该出现包含“Bar”的项目,然后应该是该列的其余部分正常订购。
这在 T-SQL 中是直截了当的,但使用 WIQL 似乎是不可能的,所以我将不胜感激任何想法或解决方法。
可能与解决方法有关的不幸事实是,TFS 实例位于 SQLExpress 而不是完整的 SQL Server 之上(它最初是一个概念证明,正在被替换,对此我无能为力目前,但我仍然需要对查询进行排序)
非常感谢西蒙