Jql select only highest value

Mohammad Alolaiwy March 25, 2021

Hi All

 

I am new user of jira.

I have a custom field with numbers in my issues.

I want to select in jql only the highest number for this field. How to do that please ?

 

Thanks

2 answers

1 accepted

2 votes
Answer accepted
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.
March 25, 2021

Hi @Mohammad Alolaiwy  -- Welcome to the Atlassian Community!

What are you doing with this number?  If you just need the value and do not need it within Jira, you could do this (substituting in your project and field name):

project = myProject AND myNumber IS NOT EMPTY ORDER BY myNumber DESC

The first issue shown will have the highest number.

Best regards,

Bill

Mohammad Alolaiwy March 25, 2021

I am using it as a custom field for version. Hence i want in my jql queries to select only the latest version. 

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.
March 25, 2021

Thanks for clarifying, and it sounds like you may be able to do this with an automation rule, using a lookup to find the issue with the maximum value and then use that issue's key to do more, as needed.

For example, let's say you wanted to create a version based on that value.  You could have a rule:

  • Trigger: some starting condition you want
  • Action: lookup issues on JQL noted above with the order by clause
  • Branch: with JQL on the key of the issue with the maximum value

key = {{lookupIssues.first.key}}

  • Action: create a version using information from the first issue's key {{issue.myNumber}}

If interested, please look here for more information about automation rules:

https://www.atlassian.com/software/jira/automation-template-library#/label/all/1453

https://community.atlassian.com/t5/Automation-articles/Jira-Automation-all-the-resources-you-need-in-one-page/ba-p/1388465

Like # people like this
Щуренко Павло February 27, 2023

Amazing!

Thank you

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 25, 2021

Hello @Mohammad Alolaiwy 

Welcome to the community.

Looking through the documentation on Advance JQL Searching, I do not see a way to do this.

Mohammad Alolaiwy March 25, 2021

Yes I tried but didn't find anything. Too bad :)

Suggest an answer

Log in or Sign up to answer