Showing results for 
Search instead for 
Do you mean 

Tech Tips & Tricks: How to query for just-updated Work Items

by Siemens Dreamer Siemens Dreamer on ‎07-18-2014 09:36 PM

Welcome to another installment in our series of tips and tricks from the Polarion Software Technical Support team, in which we share solutions we provided to customers for real-world use cases that. The same tips might help you too, or others on your team. Today,let's answer the question, "How can I query for Work Items that were updated 5 minutes ago?"

Use Case

Let's say you have a report page and on it you want to show a listing of the most recently updated Work Items in the project... items that were updated in the last, say, 5 minutes.

Solution

You'll quickly discover this can't be done with a Lucene query. So we're back to the realm of SQL, with which it's relatively easy.
#set($projectId = $page.getProject())

#set($myQuery = "SELECT items.C_PK FROM WORKITEM items, PROJECT proj WHERE =>
proj.C_ID = '${projectId}' AND items.FK_URI_PROJECT = proj.C_URI AND =>
items.C_UPDATED > DATEADD('MINUTE',-5,NOW())")

=> indicates continuation on the same line.

You can use this query in the {workitems} macro in a Wiki page. If you want to display only the number of Work Item found, rather than a listing of the items themselves, you can use the display=count parameter in the macro. We hope you find these tips helpful. If there's a topic you would like to see covered in future posts, contact the support team via the Customer Service Portal.
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