Is there a TFS query macro for the current iteration?

14,011

Solution 1

I'm afraid that there is not such a macro. I personally just have a few "X in current iteration" team queries and then edit those queries to point to the new iteration path at the start of each iteration.

Solution 2

Looks like Microsoft listened. @CurrentIteration is being added as a token.

That’s great, of course. When looking to write a query against the current sprint, however, you are in danger of losing sight of unclosed work items in previous sprints. When you reach for @CurrentIteration, you probably just mean “all unfinished work that has been committed to a sprint.” If you filter to a single sprint, you’ll miss any stragglers you failed to close or move forward from previous sprints.

Consider using the following pattern, where “ScrumOfScrums\Release 1.0.0.0″ is your backlog path, and all of your sprint paths are children to that:

TFS query of work items Under the backlog iteration node, but not equal to the backlog iteration node. Also not Closed.

Filter for work items under your backlog iteration node, but not equal to the backlog iteration node. That will give you all items committed to a sprint.

This will also catch any items that weren’t closed in your previous sprints. Since the goal is to close every item in a sprint before moving to the next one, this query pattern will generally be better than using @CurrentIteration, unless you're looking to find the closed items in the current iteration.

P.S. While this is an old question, it was my top hit when I searched for info on querying the current iteration in TFS.

Solution 3

I am going to try using a standard name for the current iteration such as 'Current'. The queries for this iteration would all reference this name. Once the iteration is completed, I will rename it using a naming convention that includes the date for example and the next iteration would then be created with the name 'Current' (or renamed to this if it already exists). The queries would then return results from the new iteration.

- 2010-49
- Current
- 2010-51

I am not sure whether renaming iterations this way will cause any conflicts or confuse the data warehouse for example but this would save on having to create or modify a heap of queries at the start of each iteration.

I would be very interested to hear feedback on this approach!

Solution 4

Query for Sprint in a date interval as shown here:

    Team Project    =   @Project
And Work Item Type  =   Sprint
And Start Date  <=  @Today
And Finish Date >=  @Today

Solution 5

I have found that Telerik's free Work Item Manager provides an elegant solution to this problem.

Just define your queries as you usually would but leave out any filters relating to iterations (note that this also applies to areas). There is a treeview pane named 'Area/Iteration Filters' that will add extra, recursive filtering based on the iteration (or area) that you select there.

Note that if the pane is not visible then you can enable it via the View menu.

alt text

Share:
14,011
Glenn Slaven
Author by

Glenn Slaven

I'm Principal Engineer at http://www.section.io Been coding for about 20 years now. I'm married &amp; have 4 great kids

Updated on July 19, 2022

Comments

  • Glenn Slaven
    Glenn Slaven almost 2 years

    Is there a way in TFS in VS2010 to specify that a particular iteration is the current one, and then return that for use in queries similar to the way @Project works? If not is there a way to do sub-queries in TFS work item queries?

  • Richard Berg
    Richard Berg over 14 years
    Same here. Likewise with WIT templates (from the power tools).
  • Glenn Slaven
    Glenn Slaven over 14 years
    Yeah, that's what we're doing too
  • Dr Rob Lang
    Dr Rob Lang almost 11 years
    In Team Foundation (Cloud), this does not work as Work Item Type cannot be a Sprint.
  • Owen Johnson
    Owen Johnson over 10 years
    After you get the sprint (or iteration), you can query for the children of that sprint/iteration.
  • Alan Larimer
    Alan Larimer about 8 years
  • Alan Larimer
    Alan Larimer about 8 years
    For TFS 2015 . . . see Dane's answer below and the link in my comment: msdn.microsoft.com/en-us/Library/vs/alm/Work/track/…
  • Beth Lang
    Beth Lang almost 8 years
    @currentIteration does not work with excel yet so you can't use it in queries that you are going to use in excel.