0

I'm performing the following lookback snapshot. I got the data back but i also need the ValidFrom Date of the Completed record. It's not a part of the _PreviousValues record. How can i get that to come back with my query?

Thanks!

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,

1 Answers1

0

It looks like what we need is something like _PreviousValues.ScheduleState._ValidFrom, but it does not exist.

I think it is not possible to get _ValidFrom value of the _PreviousValues.ScheduleState from the same query, and a separate query is needed.

For example, this query:

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

will return _PreviousValues object which only includes state value:

_PreviousValues: {
ScheduleState: "Completed"
}

Let's say one of the results has ObjectID 777.

The second query will use ObjectID(s) of the results of the first query to get the time interval when the story was in the "Completed" state:

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"]

It may return more than one snapshot, and depending on what fields are fetched there may not be an indication what changed between those snapshots (e.g. in this case TaskStatus and TaskRemainingTotal) but in any case the earliest snapshot's _ValidFrom value, _ValidFrom: "2013-06-17T18:51:36.931Z" is the date you are looking for

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"
}
]

If you are writing a code, you will get the _ValidFrom of the first element of the array of objects.

nickm
  • 5,936
  • 1
  • 13
  • 14