Forums

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

Does JQL not follow the customfield value sorting ?

Aisha M
Contributor
September 16, 2024

Hello,

I have a customfield that specifies different date increments (from 2020), no matter how I sort, the JQL always displays the oldest dates first .. .

Is there a way to fix this and make sure the JQL displays the field values exactly how I sort them ?

4 answers

1 vote
Radek Dostál
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.
September 16, 2024

First off, what is the searcher of the custom field?

Look at custom fields - find it, click edit, the searcher is listed there.

 

Based on some of the values you posted in comment replies, I assume it is most likely a text searcher, or an option searcher.

Searchers typically work on how the values are stored.

 

If this was a date, imagine it as a milliseconds, lowest to highest, highest to lowest, no problem.

If this was a string, i.e. text, it will go character by character, from the first character, to the second, to the n, and if the character (which itself is a numeric value), lowest to greatest, greatest to lowest, etc. Same thing, but it goes character by character.

^ this also applies to custom field values if your field is an option field

 

Now, what will happen if your values are:

9 X

19 X

20 X

 

Ascending, this would be 19, 20, 9 -- because it goes character by character, despite you knowing that 9 is less than 19.

 

If you use something called "natural" search or order (https://en.wikipedia.org/wiki/Natural_sort_order) then it will produce 9,19,20 because it takes care to treat numbers as whole, not by single character.

 

So I reckon, that you are using a searcher for the custom field, which probably doesn't care about the date at all, rather it cares about the sequence of characters in the values.

Aisha M
Contributor
September 16, 2024

@Radek Dostál Thank you for the detailed explanation. The searcher for the field is 'Multi Select searcher" . .

I want to add that while editing the issue, the sorting is exactly how it is configured. Only when querying in the JQL it lists the older values first

Is there any way this could be sorted so that the JQL searcher displays the field in the order of 2025,2024,2023,2022 ?

Radek Dostál
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.
September 16, 2024

Not without a "special" searcher, which I don't think I know of any.

If I understand how option searchers work then the only choice you have I'd say is to ensure that each value is in the same format.

E.g. always using 0's in case of 2-digit values, i.e. 01, 05, so that 11 and 25 are all in the correct order when sorted. Always using 4 digits for years, etc. So that indeed the sorting goes character by character and cannot fail on something missing between the values.

 

As a thought, just changing the value won't help, because it will need to re-index the values for jql to pick up on it (a single project re-index should work, but if you're using this with many then a full re-index will be better).

 

Without modifying the values, like I said it would need a custom searcher, one that Jira doesn't have natively (as far as I'm aware). It would have to supplied by a plugin, and associated with the field, some custom searcher that will treat the values in the "natural" order.

Just to be clear - the order of values in the context is ignored, it's just the values themselves.

 

Aisha M
Contributor
September 16, 2024

Yes, you are right. I looked at the values and it is most probably sorting the values by the fourth character

PI 20.1

PI 21.1

PI 22.1

PI 23.1

PI 24.1

So based on this, the older years is coming first

0 votes
Hannes Obweger - JXL for Jira
Atlassian Partner
September 24, 2024

Hi @Aisha M

could you kindly provide a screenshot of what you are seeing in Jira, along with what you'd expect to see?

Thank you,

Best,

Hannes

0 votes
Vikrant Yadav
Community Champion
September 16, 2024

Hi @Aisha M ,

You can Apply sorting on Date field as well. 

Screenshot 2024-09-16 at 1.12.48 PM.png

Aisha M
Contributor
September 16, 2024

Thank you for the reply !

The field is a Select List field with values as below,

  • PI 24.1 (01/04/24 - 03/13/24)
  • PI 24.2 (03/14/24 - 05/22/24)
  • PI 24.3 (05/23/24 - 07/31/24) & so forth

I have sorted this list from 2025 - 2019 in the custom field

 

But, when I search for this field using the JQL, the values displayed start with 2019, it does not display the values as how it been sorted in the customfield configuration.

 

 

Vikrant Yadav
Community Champion
September 16, 2024

@Aisha M  In Select list field sorting is done alphabetically by default.

0 votes
Fabio Racobaldo _Herzum_
Community Champion
September 16, 2024

Hi @Aisha M ,

you should be able to sort jql result just clicking on a specific column and define order for that. Isn't it?

Fabio

Aisha M
Contributor
September 16, 2024

Thank you for the reply ! I not talking about the JQL result, but the field values displayed while using a JQL

The field is a Select List field with values as below,

  • PI 24.1 (01/04/24 - 03/13/24)
  • PI 24.2 (03/14/24 - 05/22/24)
  • PI 24.3 (05/23/24 - 07/31/24) & so forth

I have sorted this list from 2025 - 2019 in the custom field

 

But, when I search for this field using the JQL, the values displayed start with 2019, it does not display the values as how it been sorted in the customfield configuration.

 

 

Suggest an answer

Log in or Sign up to answer