Jrules80
Jrules80

Reputation: 178

nested queries in Rally Agile Central

can someone show me how to nest query in a query in Agile central? I am trying to filter all the stories belonging to all the features under a given initiative.

So, the hierarchy will be:

Epic/Initiative **XYZ**  >> Feature A /Story 1
                         >> Feature B /Story 2/Story 3/Story 4
                         >> Feature B /Story 5/Story 6/Story 7 

So, I need one query where I need to show all the stories and their corresponding features under Epic/Initiative XYZ

Upvotes: 0

Views: 249

Answers (1)

user2738882
user2738882

Reputation: 1190

Something like that:

from pyral import Rally

INITIATIVE_ID = "{{ YOUR_INITIATIVE_ID }}"
RESULT_MAP = {}

rally = Rally(server="rally1.rallydev.com",
              apikey="{{ YOUR_API_KEY }}",
              workspace="{{ YOUR_WORKSPACE }}",
              project="{{ YOUR_PROJECT }}")

initative_req = rally.get("PortfolioItem/Initiative", fetch=True, query=("FormattedID = %s") % INITIATIVE_ID,
                          pagesize=2000,
                          projectScopeDown=True)

initiative = initative_req.next()

for feature in initiative.Children:
    RESULT_MAP[feature.FormattedID] = [user_story.FormattedID for user_story in feature.UserStories] if (
            feature.DirectChildrenCount > 0) else []

print RESULT_MAP

Upvotes: 1

Related Questions