It's all about the answers!

Ask a question

How can I query for work items that do NOT have a parent


Hooch Holly (7442024) | asked Jan 28 '13, 3:35 p.m.
edited Jan 28 '13, 3:39 p.m.

As stated, I'd like to find workitems in my system that do not have a parent relationship defined.  I like to have all my work items nested under a story, but sometimes the devs create a work item and forget to set the parent.

How can I find them?

Also, if there is a way to make setting the parent relationship a requirment before a workitem can be saved, that would prevent future occurences.


Comments
Buzz Moschetti commented Jan 28 '13, 10:55 p.m.

Are you willing to do some OSLC?

If you want to restrict this to a project area, call this URL as follows:
accept:  application/xml
OSLC-Core-Version: 2.0
{YOURrOOT}'/ccm/oslc/contexts/$projectAreaID/workitems?oslc.prefix=rtc_cm=<http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/>&oslc.properties=rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent

rdfs:member entries will either contain the tag rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent or not so you can find the parents.   Note that the call is paging type; you'll have to check for oslc:nextPage in the result and if present, iteratively call it until all pages of data have been fetched.   THere is no way to filter for items whose parent is a story; the filtering doesn't "read thru" the resource link.

Accepted answer


permanent link
Daniel Toczala (88211514) | answered Jan 29 '13, 10:18 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Jan 29 '13, 10:27 a.m.
Building on what Sam showed, there is a Parent choice in the query builder.  Select it, and then note that you can choose to include a work item if the parent exists, or does not exist.  In your case, you want "do not exist".

Screen capture


Hooch Holly selected this answer as the correct answer

2 other answers



permanent link
sam detweiler (12.5k6195201) | answered Jan 28 '13, 5:33 p.m.
edited Jan 28 '13, 5:35 p.m.
I see Parent as a choice in the Query builder. both web and eclipse..

allows me to check has or does not have parent set..



don't think there is a required dependent link  function built in.

permanent link
Hooch Holly (7442024) | answered Jan 29 '13, 1:50 p.m.

Doh!  I don't know how I missed the "Parent" field in the Query builder. 

Thanks!

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.