help with wiqlQuery

Hi All,

I am learning wiqlQuery but I have an urgent requirement to get the following info:

Finding SUM(Completed Hours) for a personbetween a date rangefor all projects( or a given project)

Actually we want to derive the utilization of a resource.....

Please help me with the query, its urgent

[422 byte] By [Sanjoyan] at [2008-2-22]
# 1

Unfortunately this version of WIQL does not support aggregate functions like sum, avg, etc.

Thanks,

Alex

# 2

Ok then .... but using the query if I can get all the revisions/changes of all work items for a given person between a date range .... then I can simply loop and sum up .....

so can anybody help me with this query ........

Also I tried using the object model as below ... but having some problem ..

TeamFoundationServer tfs = GetServer(http://tfsserver:8080);
WorkItemStore store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

Project project = store.Projects["VersionControl_Sanjoyan"];

string wiqlQuery = "SELECT [System.ID] FROM WorkItems WHERE [System.AreaPath] = 'VersionControl_Sanjoyan' and [Work Item Type] = 'Task' and [Assigned To]='Sanjoyan'";

WorkItemCollection workitems = project.Store.Query(wiqlQuery); int y=0;

for(int i = workitems[0].Revision; i>=1;i--)
{
WorkItem x = store.GetWorkItem(workitems[0].Id, i);
y=y+x.Fields["Completed Hours"];
}
Using this logic I only want to consider only the completed hours within a date range .... which date field I need to consider..............

Sanjoyan at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Work Item Tracking...
# 3

You cannot get multiple revisions in a single query. WIQL allows to create queries as of certain date (using 'asof <date>' at the end of your query), and this is everything we have in queries for working with revisions.

Thanks,

Alex

Visual Studio Team System

Site Classified