Showing results for 
Search instead for 
Do you mean 

Tech Tips & Tricks: Query 'remaining estimate' from a specific date

by Siemens Dreamer Siemens Dreamer on ‎06-18-2014 10:03 PM

Welcome to the first of a series of tips and tricks from the Polarion Software Technical Support team. In this series we'll be showcasing solutions to several use cases that we provided to customers. The positive response we got from the customer in each case led us to think that these tips might help other Polarion users too. So let's begin with how to query for values in the Remaining Estimate field of Work Items starting from a certain date. 

Use Case

Search for remaining (or initial) estimates in a given time range. Example:
  • All implementation tasks of a project shall be finished end of November 2013.
  • In the Live Plan I see, that some tasks exceed this deadline.
  • Today is 3 days before the end of November 2013 which means I need to find workitems having remaining estimate longer than 3 days
Customer's question: "I would like to know how much remaining work will be open after end of November."

Solutions

Here a several examples you can use in Wiki pages: 1. Tasks with some Remaining Estimate
#set($projectId = $page.getProject())
#set($tasks = $trackerService.queryWorkItems("project.id:$projectId AND type:task => 
AND HAS_VALUE:remainingEstimate","id"))
* Number: $tasks.size()

=> indicates line continuation

2. The DurationType Object - value minus 3d
#set($duration3d = $tasks.get(0).getRemainingEstimate().parseDuration("3d"))
* Duration: $duration3d.toString()
#set($x = $duration3d.setNegative(true))
* Negative: $duration3d.isNegative()
3.  Find Tasks with Remaining Estimate value of more than three days
#foreach($task in $tasks)
#set($re = $task.getRemainingEstimate())
#set($x = $re.add($duration3d))
#if(!$re.isNegative())
* Task: $task.getId()
* Overdue: $re
#end
#end
For the sum of the overdue time you need another DurationTime variable:
#set($total = $tasks.get(0).getRemainingEstimate().parseDuration("0d"))
In the foreach cycle you can sum the overdue values:
#set($x = $total.add($re))
and display the total value after the cycle. It would be better if you tested the number of tasks and continue only if there is a non-zero number of them:
#if($tasks.size()>0)
...
...
#end
Here's hoping you might find these tips useful sometime. Watch the blog or RSS feed for more Tech Tips from Polarion Technical Support.
Jiri Jandl is a Senior Support Engineer with Polarion Software's European tech support team. He is based in Prague, Czech Republic.

Banner: It's all about solutions - Polarion Silver and Gold Support