-1

I am trying to create a query using WIQL which later I am opening in TFS. I want a field in my bug report that shows for how many days a bug is open. Below is the query:

<?xml version="1.0" encoding="utf-8"?>
<WorkItemQuery Version="1"><Wiql>
SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State],@today-[System.CreatedDate] as 'Days' FROM WorkItems 
WHERE [System.TeamProject] = @project  AND  [System.WorkItemType] = 'Bug' 
 </Wiql>
 </WorkItemQuery>

When I am opening this .txt file in Visual studio as a query it is showing me an error saying 'The query statement is missing a FROM clause'.

Am I writing the correct query? Or is there anything I should update so that the query works fine and it gives me number of days a bug is open as a field in my Bug summary.

Thanks in advance.

  • I'm not sure using an `as` for an alias is accepted. Can you try it without the `as 'Days'`? I would also remove your domain and project name from the code in your post. – spikey_richie Dec 24 '21 at 14:41
  • I don't think you can include operators like addition and subtraction. WIQL is SQL-like but it's not SQL. – Daniel Mann Dec 26 '21 at 16:42
  • So any other way to create a customized query in TFS that will give me a result or a bug summary table that will give me number of bugs open till date? – AutomationTester Dec 27 '21 at 05:38

1 Answers1

1

Azure DevOps Server (TFS) does not support calculated fields or calculated query columns. You can try to use:

  1. Excel with formulas: Add or modify Azure Boards work items in bulk with Microsoft Excel
  2. Powers BI reports: Calculate time-in-state for an existing Analytics view
Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31
  • This would be a good solution. Create a simple query showing all bugs, their state, and when they were created. Then do a `datediff()`/`daysbetween` `now()` and the created date. – spikey_richie Dec 30 '21 at 15:41