It's all about the answers!

Ask a question

QueryBuilder: how to build a query that checks for the value of an attribute of all of the children

Susan Hanson (1.6k2190193) | asked Jul 14 '13, 9:57 p.m.
I am trying to build a query that looks at a specific attribute in all of the children.  For example:

Query all "Story" work items that does not have at least one child work item that contains a certain string in the summary.  For example, if we preface our documentation work with "ID:" in the summary, we are looking for Stories that are missing a child task to update the documentation.

I've tried Type is Story & Children>Summary does not contain ID:
but that seems to show me those where EVERY child summary does not contain ID:, not a story that doesn't contain ANY child summary with ID:


2 answers

permanent link
Ralph Schoon (61.4k33643) | answered Jul 15 '13, 3:56 a.m.
I don't believe that is possible today. I have tried to do questions such as "For All children(State=closed)" but I was not very successful.I don't think the query engine today has this kind of operator. I think the queries I came up with always returned elements that had at least one child that was qualified for the condition.

Guido has filed this enhancement request:

There are several more you probably want to add your interest.

Susan Hanson commented Jul 15 '13, 4:08 a.m.

Thanks, I"ve added myself as a subscriber.

Ralph Schoon commented Jul 15 '13, 4:17 a.m.

please add a comment that you struggle with the same issues, to give it more attention.

permanent link
Indradri Basu (1.8k1514) | answered Jul 15 '13, 3:23 a.m.
If I understood your concern correctly, you probably have to add another condition like "AND Children>Type is Story" to get only Child Stories listed in the result.

Susan Hanson commented Jul 15 '13, 4:03 a.m.

my child type's are Tasks, but adding and Children>Type = Task doesn't help.  It basically brings back every story because every story has at least 1 task that is NOT an ID task, and I want it to bring me stories that have child tasks but that doesn't have at least one child.

For example:
Story 1
    Task 1  Summary = Update this
    Task2   Summary = Update that
     Task 3 Summary = ID: doc it all

So this Story 1 has 3 children and 1 of them says "ID:"
but if I have Story 2 that only has Task 1 and Task 2, then I have a story that has children and at least 1 child does NOT have ID: in the summary.

Your answer

Register or to post your answer.