Macro: get Number of certain Elements as Integer

Description
dani
Posts: 3
Joined: Tue Jun 24, 2014 6:35 am

Macro: get Number of certain Elements as Integer

Postby dani » Tue Jun 24, 2014 6:45 am

Hi,

In a document I'm trying to get the number of elements that have a certain status:

Code: Select all

{workitems: status:stDrf | display=count }


This would print out a number embedded in a linking element. However instead I want to have the number as a bare naked integer in the macro itself already in order to be able to print out a specific text depending on how many there actually are.

How can this be achieved?

Many thanks in advance
Dani

hseifert
Posts: 21
Joined: Wed Apr 17, 2013 12:10 pm
Location: Böblingen, Baden-Württemberg, Germany
Contact:

Re: Macro: get Number of certain Elements as Integer

Postby hseifert » Fri Jun 27, 2014 7:34 am

Hello,

you can get the count with:

Code: Select all

$trackerService.queryWorkItems("status:stDrf", "id").size()


Or, if you want to use the count on several positions an the page:

Code: Select all

#set($count = $trackerService.queryWorkItems("status:stDrf", "id").size())
We have $count items with status 'stDrf'.
Kind regards.

Hagen

martins
Posts: 181
Joined: Thu Nov 05, 2009 3:24 pm

Re: Macro: get Number of certain Elements as Integer

Postby martins » Fri Jun 27, 2014 11:24 am

Or you can use dataservice:

Code: Select all

$trackerService.dataService.getInstancesCount("WorkItem", "status:stDrf")

Martin


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 7 guests