6

Suppose I have the following JIRA filter.

project = XXX AND resolution = Unresolved AND assignee in (EMPTY) ORDER BY Type asc, priority desc

I use it to see all unassigned issues in a certain project and pull from for triage.

Every now-and-then, I need to know how many are in each Type, i.e., I actually want a count for each.

How could I modify this query to do that or write a new one that accomplishes the same thing?

Adil B
  • 9,911
  • 10
  • 41
  • 55
MadPhysicist
  • 4,190
  • 7
  • 27
  • 80

1 Answers1

7

Remember that JQL isn't SQL - it just operates on tickets and returns lists of them for other parts of JIRA to consume, and doesn't really have a mechanism for counting results.

That said, you can use the JIRA REST API's /search endpoint along with maxResults=0 to construct JQL queries for each Type you care about, and the endpoint will give you a total value for that ticket Type:

https://jira.url/rest/api/latest/search?jql=project%20=%20XXX%20AND%20resolution%20=%20Unresolved%20AND%20assignee%20in%20%28EMPTY%29%20AND%20Type%20=%20Task&maxResults=0

Results in this output for Type=Task:

{
    "startAt":0,
    "maxResults":0,
    "total":123,
    "issues":[]
}
Adil B
  • 9,911
  • 10
  • 41
  • 55
  • 1
    Much appreciated. Do you know if JIRA allows one to monitor statistics on such things? That is, is there a page that could plot trends for these quantities or do I need to invent one myself and query these end-points? – MadPhysicist Feb 01 '19 at 16:37
  • Yeah - you'll need to make your JQL query into a Filter. Then, create a JIRA Dashboard, add the "Issue Statistics" gadget to it, and set the gadget's "Statistic Type" to "Issue Type" and choose your Filter to use as the gadget's basis. – Adil B Feb 01 '19 at 17:04