Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the row count in a Jira query?

Jose Ariel Laureano Ramirez
Contributor
August 16, 2021

I want to get the amount of rows returned from a Jira query, just like the count() function that it is used in SQL.

3 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 17, 2021

Hi @Jose Ariel Laureano Ramirez 

Running a JQL statement from the user interface will not show the count when it is above the limit.  However if you call the REST API search method for your JQL the "total" field will show the count.

Based upon your other recent questions/posts, I wonder if this is this for an automation rule.  If so, you may call the REST API from an automation rule using a web request to get the count.  Here is a how-to for making such a call: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

Best regards,
Bill

0 votes
Jose Ariel Laureano Ramirez
Contributor
August 17, 2021

thanks @Nir Haimov but I would like to get it via a query so I can say for example: If result is >=100 then do this else do that. Did it make sense to you?

0 votes
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 16, 2021

Hi @Jose Ariel Laureano Ramirez 

It's already written in the filter screen (see attached)

2021-08-17_09-11-10 (5).png

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2021

Hi @Jose Ariel Laureano Ramirez 

Yes, it make sense, if you are running this JQL via external code, i thought you are asking it via Jira UI.

If you are running a JQL via the API: https://docs.atlassian.com/software/jira/docs/api/REST/8.14.1/#api/2/search

you can use the "total" entity, which tells you the count of records...

Like Sierra Larsen likes this

Suggest an answer

Log in or Sign up to answer