Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JQL : Can you order by a substring?

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

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
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

161 views 2 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you