JQL : Can you order by a substring?

Mark Sta Ana July 9, 2021

I've got a bunch of tickets with the following summaries

  • key, summary
  • JIRA-122, 1.1 - Do bar
  • JIRA-1, 1.3 - Do bedobedo
  • JIRA-5, 1.2 - Do bby is a free elf
  • JIRA-123, 1.1 - Do foo

 

I'd like to be able to do something like this: `ORDER BY substring(summary, 1,3), key` so I get an ordered list like this

  • JIRA-122, 1.1 - Do bar
  • JIRA-123, 1.1 - Do foo
  • JIRA-5, 1.2 - Do bby is a free elf
  • JIRA-1, 1.3 - Do bedobedo

Never mind the naive substring selection (I know it'll break if those numbers go into double digits), but can I do an ORDER BY like this?

 

I've got a horrible feeling (since I've not been able to find any examples), I'll need to create a custom field and store the rank there and sort that.

1 answer

1 accepted

1 vote
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.
July 9, 2021

Hi @Mark Sta Ana 

In your example, the thing you wanted to sort-by was always at the beginning of the summary.  So why not just ORDER BY summary?

If instead your substring is after the beginning, you would:

  • need some type of scripting addon;
  • extract the values into a custom field, and then sort; or
  • if you only need this a few times, export to a spreadsheet to do it.

Best regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events