Rally Software

 View Only
  • 1.  Query to count the number of leaf Projects?

    Posted Mar 09, 2017 07:48 AM

    I have an odd use case and I'm wondering whether a query guru out there somewhere might have an idea how to solve it. I have a parent in my project tree under which I place outdated projects that I don't want to close for various reasons. Some of my stakeholders want to be able to check in on an ongoing basis and see how many projects are under this parent. There are already over 100 and counting them by hand is too laborious to be practical, plus I need to be able to produce a count on demand.


    Does anyone have any ideas for a query or other trick to count the leaf projects in this branch? There are not only direct children of the branch but also grand- and great-grand-children. 


    Come on... I know you can do it ;-)

  • 2.  Re: Query to count the number of leaf Projects?

    Posted Mar 17, 2017 06:20 PM

    Hey Eric,


    I know nowhere near as much as you about this sort of stuff, but couldn't you use an WSAPI query for this sort of request?


    Something like the below should work - of course substituting the Project OID for the brackets below: 



    So it would look something like this:


    Then the output would include (amongst a bunch of other stuff) the Total Result Count of the # of children for that project:  "TotalResultCount": 9,


    Maybe that'll get you started, anyway!



  • 3.  Re: Query to count the number of leaf Projects?
    Best Answer

    Posted Mar 20, 2017 06:06 PM

    Hi John/Eric,

    Unfortunately that only gives the direct leaf count, if there are children of the children they will not be included in the TotalResultCount. I cannot see a way to easily get that information with one simple query or WSAPI request.


    Running a request on the project endpoint will give you a total project count including all leaf projects for the workspace, for example:



    I run the above in my workspace, and it correctly returns 14 projects for the TotalResultCount, but I do not see a way to get that for a particular project without creating code to calculate.


    Sean Davis