Products

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

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


Comments

One thought about “Tech Tips & Tricks: How to query for just-updated Work Items
  • I’m a novice when it comees to scripting and am looking for an easy way to display only Work Items that have been completed (final status) in the last 7 days…

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/polarion/tech-tips-tricks-how-to-query-for-just-updated-work-items/