In ADO I have a single parent work item with child work items. The children work items, in turn have related work items. The number of child items will grow as time progresses.
What I'm trying to get is the list of the related work items. This would be pretty trivial if the list of child work items wasn't growing, but I don't want to have to edit a simple tree query by adding a new work item ID to the top level of the query whenever a new child work item is created.
Is there a way in WIQL that I can write a query that effectively says, "get the children of item #xxxxx, then get the related items for each of those children?"
If you have a single known parent that will never change, all you need to do is create a query with the following parameters:
Type of query: Tree of work items
Type of tree: Parent/Child
In your filters for top level work items, specify the parent work item ID. In your filters for linked work items, don't specify anything. All work items that live below the parent will be returned, with the parent at the top of the query.
Related
I have a list of many objects. Further, I have an additional group of lists consuming those objects. It's a strict rule that any given object either belong to the main list, or one of the other lists.
In general, the main object contains a master list of objects. Further, this main object also has its own concept of grouping these objects together into any separate arbitrary list.
I'd like to be able to query a list of those objects which are not currently a part of any of the other lists. I can naturally assume that I can synchronize a dedicated list of these objects, but that's not how I need to approach this. Instead, at any given time, I need to be able to fetch a list of those objects which are NOT a part of any of those group lists.
Another way put, out of that big giant list of all possible objects, I need to be able to iterate one by one through those which are NOT a part of any of the other group lists. Identifying whether it's a part of one of those lists is easy. But how do I fetch a list of items which are NOT a part of any group?
Specifically, without creating a whole separate list. I intend to use this main list of objects, yet filter out those objects which are a part of any given sub-list of objects.
More specifically, I need to be able to traverse through the list of objects which are not a part of any other list. I'd hate to keep track of a totally separate "ugrouped" list. I'd rather use the main list, and iterate each object in order in the list, while skipping over those objects which are part of the sub-lists.
For example, let's say I have a master list of 100 widgets. Only 30 of those have been categorized into some specific group list. The other 70 objects need to still be accessible by querying a list.
I'm looking for a loop something like...
for X := 0 to UngroupedObjectCount-1 do begin
O:= UngroupedObjectByIndex[X];
//TODO: Do something with O
end;
I'm working in a project with a huge backlog, which structure is defined and can't be changed anymore.
In our Work Breakdown Structure (WBS) we have several epics and their user stories defined. For project reporting purposes we do have "checkpoints" defined.
Each checkpoint has a bunch of epics as predecessors. So only if we have completed all epics, we can pass the checkpoint.
In TFS 2013 I do have a query to display all checkpoints. Checkpoints are a PBI with the title [Checkpoint]. In this query, I get also the predecessors (epics) for this checkpoint.
Now I would like to get all children of these epics (e.g.):
[Checkpoint]"Infrastructure ready"
-Link Type "Predecessor": [Epic] "Set-up TFS"
---Link Type "Child": [Story]"Request project in dev-ops"
---Link Type "Child": [Story]"Set-up Build Environment"
-Link Type "Predecessor": [Epic] "Set-up Development Environment"
---Link Type "Child": [Story] "Create Docker-Container"`
Currently, I'm only able to query for the checkpoints and their predecessors. I'm struggling to get the children of the predecessors in the same query.
Adding a picture of the current situation:
Query with missing children
In the picture, you see that the children of the [Epic] PBI's are missing.
If you mean that you want to list all the Parent and Child work items, then you can create a type of query : Tree of work items. Reference the first screenshot for detials:
If you want to get the Parent and Child work items for a specific work item, then you can create a type of query: Work items and direct links. Reference the second screenshot for details.
UPDATE:
We can not get all work items with their parent and child work items in one query. You can try to specify the specific work item ID in Work items and direct links query, just as the example in my answer, Then you can get the three level work items related to that specific work item. We can only do this with the query, you may want to get all related work items with the three level, but unfortunately that's not supported.
You have to set-up several queries or have different ID with an OR-Query, that shoule works.
I created a TFS Query which works fine if runs as simple flat list query, there are no Terminated items as expected. Note that the brackets [] indicate the grouping.
Team Project = #Project
[ And Work Item Type = Epic
Or Work Item Type = Improvement ]
And State <> Terminated
[ And Iteration Path Under A\B1
Or Iteration Path Under A\B2 ]
Now I want to use this as a query for linked items within a tree query though. In this case I get linked work items in the state Terminated even though I explicitly exclude them in the query. Why is this?
I can imagine that this may be the case due to the children not being terminated, however I still would expect them to be filtered, because in a flat list they are filtered as well.
Which filtered option you select in your query. To find linked children, select Match top-level work items first. To find linked parents, select Match linked work items first.
You can also achieve that result by creating some custom code that uses the tfs api to execute two queries (parent/children) and intersect their results.
I would like create a Flat list of work items query in TFS in which the results contain all of the specified PBI and Bug cases and any Task cases that have no parent.
It's that Task with no parent part that has me perplexed. I cannot see a way that I can do what seems so obvious such as (Parent Link Count = 0) because that attribute is not exposed to me though, strangely, some other link type counts are.
Any ideas?
You need to change the type of your query to the Direct Links query, then choose the option to pull back all work items without any matching links. The results will still be a flat list.
We are using the agile template, and have user story's with linked tasks.
Some user stories assigned to me and some tasks, for users stories, are assigned to me.
What I'm trying to get is all work items that are assigned to me, or work items where a linked work item is assigned to me in a tree of work items view (not flat list)
So right now I have:
any work item in this project and iteration (not closed\resolved, and not a bug)
AND
any linked work items assigned to me (not closed\resolved)
But this returns user stories, where I don't have tasks assigned to me. But if I change the first part of the query to be filter out items not assigned to me the 'Tree of Work Items' is not show for where I only have tasks.
The output I would like would exclude user stories where I don't have tasks, and include users stories where I do... something like this:
User Story 1 --> team member A
---->Task 1a --> me
User Story 2 --> me
---> Task 2a --> team member B
Any ideas what the query would be?
Thanks
What you want is not possible in one single query. The filter you do on the parent and on the child will be combined to an "AND" filter operation.
To get only the parents for which you have tasks, choose the query type "Work Items and Direct Links" and in the child section add a filter on "assigned to = #me" and select the option "Only return items that have specified links".
Seems like that has been improved as of TFS 2012.
You can have a Tree of Work Items, where your linked work items are filtered according to your preferences (assigned to me, not closed, iteration etc.)
Then make sure to add "Filter options" -> Match lined work items first -> Parent/Child
That should filter any parents, not having sub tasks assigned to you and other filters you applied.