Lookback API: How long is a defect in a particular state?
        Posted  
        
            by 
                user1195996
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user1195996
        
        
        
        Published on 2012-10-24T23:52:08Z
        Indexed on 
            2012/10/25
            5:01 UTC
        
        
        Read the original article
        Hit count: 227
        
rally
We have a state in our defects called "Need More Information". I would like to create a graph over time of how many defects are in that state at any particular period of time.
I think I can get the info to do that with the Lookback API with the following query:
my $find = {
        State                   => 'Need More Information',
        '_PreviousValues.State' =>  {'$ne' => 'Need More Information'},
        _TypeHierarchy          => -51006, # defect
        _ValidFrom  => {
            '$gte'  => '2012-09-01TZ',
            '$lt'   => '2012-10-23TZ',
        }
I thought that would give me back a list of all defect snapshots where the defect was transitioning into "Need More Information" state, but it does not (seems to list everything that was ever in "Need More Information" state.
Technically what I need is a query that lists snapshots of any defects transitioning either TO OR FROM the "Need More Information" state, but since this simpler one did not seem to work as I expected, I thought I would ask first why the query above did not work the way I expected.
© Stack Overflow or respective owner