我正在执行以下回顾快照。我收到了数据,但我还需要Completed记录的ValidFrom日期。它不是_PreviousValues记录的一部分。我如何才能通过我的查询回来?
谢谢!
find: {
'_TypeHierarchy': 'HierarchicalRequirement',
'Children':null,'ScheduleState':'Accepted',
'_PreviousValues.ScheduleState':'Completed',
'_ValidFrom': { '$gte':startDate},
'_ValidTo': { '$lte': endDate},
},
fetch: ['FormattedID','Name','_ValidFrom','_ValidTo','BlockedReason','_User','WorkProduct','ScheduleState','_PreviousValues.ScheduleState','AcceptedDate'],
// order: 'OpenedDate DESC',
hydrate: ['FormattedID','Name','_ValidFrom','_ValidTo','BlockedReason','_User','WorkProduct','ScheduleState','_PreviousValues.ScheduleState','AcceptedDate'],
compress: true,
答案 0 :(得分:0)
看起来我们需要的是像_PreviousValues.ScheduleState._ValidFrom
这样的东西,但它不存在。
我认为不可能从同一查询中获取_ValidFrom
的{{1}}值,并且需要单独的查询。
例如,此查询:
_PreviousValues.ScheduleState
将返回仅包含状态值的_PreviousValues对象:
https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/1234/artifact/snapshot/query.js?find={"Project":5678,"_TypeHierarchy":"HierarchicalRequirement","ScheduleState":"Accepted", "_PreviousValues.ScheduleState": "Completed"}&fields=["ObjectID","_ValidFrom","_ValidTo","ScheduleState","_PreviousValues.ScheduleState"]&hydrate=["ScheduleState","_PreviousValues.ScheduleState"]&compress=true
假设其中一个结果有ObjectID 777。
第二个查询将使用第一个查询结果的ObjectID来获取故事处于“已完成”状态的时间间隔:
_PreviousValues: {
ScheduleState: "Completed"
}
它可能返回多个快照,并且根据获取的字段,可能没有指示这些快照之间发生了什么变化(例如在这种情况下为TaskStatus和TaskRemainingTotal),但无论如何最早的快照是https://rally1.rallydev.com/analytics/v2.0/service/rally/workspace/1234/artifact/snapshot/query.js?find={"ObjectID":777,"ScheduleState": "Completed","_PreviousValues.ScheduleState": "In-Progress"}&fields=["ObjectID","_ValidFrom","_ValidTo","ScheduleState"]&hydrate=["ScheduleState"]
值_ValidFrom
是您要查找的日期
_ValidFrom: "2013-06-17T18:51:36.931Z"
如果您正在编写代码,您将获得对象数组的第一个元素的Results:
[
{
_ValidFrom: "2013-06-17T18:51:36.931Z",
_ValidTo: "2013-06-17T18:51:44.382Z",
ObjectID: 12353154323,
ScheduleState: "Completed"
},
{
_ValidFrom: "2013-06-17T18:55:50.897Z",
_ValidTo: "2013-06-18T20:53:01.755Z",
ObjectID: 12353154323,
ScheduleState: "Completed"
}
]
。