0

I have User Stories , and want to track the changes in a custom field C_L3KanbanStage, for my stories in between a date.

Is this possible. The problem I am facing, is that, I am not getting expected output.

As per my understanding, this field C_L3KanbanStage, being a drop down field, I should be able to use the comparison operators, but somehow it is not working

{
  "_ProjectHierarchy": XXXXX,
  "ObjectID": XXXX,
  "c_L3KanbanStage": {
    "$lt": "Closed"
  },
  "_ValidFrom": {
    "$gte": "2014-03-03",
    "$lt": "2014-04-15"
  }
}

It should give me all lesser values then "Closed", but it gives me only one value.

However, if I try:

{
  "_ProjectHierarchy": XXXX,
  "ObjectID": XXXX,
  "c_L3KanbanStage": "In Progress",
  "_ValidFrom": {
    "$gte": "2014-03-03",
    "$lt": "2014-04-15"
  }
} 

Then it gives me two snapshots. I am not sure, if I am trying something wrong or missing something. Can somebody please help me on this.

Basically I want to achieve something like, within two dates I want to get each transition in the value for c_L3KanbanStage

{
  "_ProjectHierarchy": XXXXX,
  "ObjectID": XXXXX,
  "_PreviousValues.c_L3KanbanStage": {"$in": ["Advance Investigation"]},
  "c_L3KanbanStage": {"$in": ["Closed","Verified"]}
}

Can any one please help me on the same.

1 Answers1

1

Your approach should work, but here are some reasons you might not get the expected query results.

If you query by ObjectID, you should only need to specify _ProjectHierarchy if the artifact moved from one project to another at some point. Try removing that.

{
  "ObjectID": XXXXX,
  "_PreviousValues.c_L3KanbanStage": { "$in": ["Advance Investigation"] },
  "c_L3KanbanStage": { "$in": ["Closed","Verified"] }
}

You can also use $gt and $lt for state fields. For example,

{
  "ObjectID": XXXXX,
  "c_L3KanbanStage": { "$gte": "Closed" },
  "_PreviousValues.c_L3KanbanStage": { "$lt": "Closed" }    
}

Once you see the expected snapshots without specifying a date range, try adding that part to the query.

{
   "ObjectID": XXXXX,
   "c_L3KanbanStage": { "$gte": "Closed" },
   "_PreviousValues.c_L3KanbanStage": { "$lt": "Closed" } 
   "_ValidFrom": {
     "$gte": "2014-03-03",
     "$lt": "2014-04-15"
   } 
}

In case it helps, the Lookback API documentation has examples of state transition queries.

johnr
  • 98
  • 6
  • Thanks john. However as I had mentioned, when I am using the project hierarchy, then also the "c_L3KanbanStage": "In Progress",, gives results but "c_L3KanbanStage": { "$lt": "Closed" } does not gives them. This is what is confusing me more – user3129202 Apr 18 '14 at 04:21
  • I tried that as well, sir. But does not help. I tried { "ObjectID": XXXX, "c_L3KanbanStage": { "$gte": "Closed" }, "_PreviousValues.c_L3KanbanStage": { "$lt": "Closed" } } – user3129202 Apr 18 '14 at 09:08
  • If you remove the date boundaries, do the snapshots show expected progression? Try sort: { _SnapshotNumber: 1 } and fields: true to improve readability. Could there be something odd in the life of this artifact that's producing odd results? Also, does c_L3KanbanStage show strings or OIDs. My suggestions assume strings. – johnr Apr 18 '14 at 14:58
  • Sorry for being late to reply on this. The expected snapshots are only seen if I use equal operator, as soon as I try to use comparison operators, it stops working. Also c_L3KanbanStage, shows string itself, hence I dont think this has to do with OID's. I believe, that somehow, Rally is not understanding the hierarchy for the drop down field. – user3129202 Apr 30 '14 at 05:28
  • Hello John, Is there a way I can confirm that Rally understands the hierarchy for my field? – user3129202 May 05 '14 at 05:33
  • I think it's more an order than a hierarchy. The ordering is determined by the list of values when you edit a multivalue custom field. You can verify this in the field editing screen. – johnr Aug 19 '14 at 22:47