工作项链接历史记录表

更新:2010 年 7 月

通过使用 FactWorkItemLinkHistory 和关联的维度表,您可以查询 Bug、任务和其他类型工作项之间的链接。 若要包含有关链接的工作项的详细信息,您可以将 SourceWorkItemID 和 TargetWorkItemID 联接到 Dim.System_ID。

“工作项之间的链接”事实数据表

FactWorkItemLinkHistory 与下列维度表相关联:

  • DimTeamProject

  • DimPerson

  • DimWorkItem

提示

此表包含已移除的链接。 对于没有移除的链接,其 RemovedDate 被设置为“9999 年 1 月 1 日”。 如果移除链接,则移除日期将设置为移除该链接时的日期和时间。 您可以使用 RemovedDate > GetDate() 筛选出已移除的链接。

可以使用以下示例查询来查找下列类型的信息:

  • 已完成的工时总数

  • 估计的原始工作量

  • 剩余工作量

  • 指定区域路径下的团队项目中每个用户情景的情景点总数

有关示例查询中使用的 Coalesce 函数的信息,请参见 Microsoft 网站上的以下页面:COALESCE (Transact-SQL)

提示

此查询假定用户情景是通过子链接来链接到其他工作项的。

declare @TeamProjectNodeSK int
select @TeamProjectNodeSK = ProjectNodeSK from GetProjectNodeInfoFromReportFolder(N'/TfsReports/VSTSDF/ProcessDev10')
-- This table-value function returns the ProjectNodeSK: the Surrogate Key of a team project under a certain area path.

declare @TeamProjectCollectionGuid nvarchar(36)
select @TeamProjectCollectionGuid = pc.ProjectNodeGUID from DimTeamProject p inner join DimTeamProject pc on p.ParentNodeSK = pc.ProjectNodeSK where p.ProjectNodeSK = @TeamProjectNodeSK
-- This query finds the team project collection GUID by joining TeamProject.ParentNodeSK to TeamProject.ProjectNodeSK

select 
     wi.System_Title
    ,wi.System_Id
    ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_CompletedWork), 0) as Total_CompletedWork -- Finds the total number of hours of completed work.
   ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_OriginalEstimate), 0) as Total_OriginalEstimate --Finds the total number of hours of original estimate.
    ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_RemainingWork), 0) as Total_RemainingWork --Finds the total number of hours of remaining work.
    ,coalesce(sum(cwi_child.Microsoft_VSTS_Scheduling_StoryPoints), 0) as Total_StoryPoints --Finds the total story points.
from
    DimWorkItem wi
cross apply
    GetWorkItemsTree(@TeamProjectCollectionGuid, wi.System_Id, N'Child', DEFAULT) wit 
left join        
    FactCurrentWorkItem cwi_child
        on cwi_child.WorkItemSK = wit.ChildWorkItemSK
where
    wi.TeamProjectSK = @TeamProjectNodeSK 
    and wi.System_WorkItemType = N'User Story'
    and wi.System_RevisedDate = CONVERT(datetime, '9999', 126)--The revised date of the work item is equal to today.
    and wi.System_State = N'Active'
group by wi.System_Id, wi.System_Title
order by wi.System_Id

请参见

其他资源

自定义如何通过链接类型关联工作项

Visual Studio ALM 报告中的新增功能

使用 Visual Studio ALM 的关系型数据仓库数据库生成报表

修订记录

日期

修订记录

原因

2010 年 7 月

添加了链接的维度表列表。

信息补充。