Forums

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

How to order a date field in a filter, empty first and biggest last?

Ralf Monferrini
Contributor
December 7, 2023

Hi everyone!


I would like to order a board filter based on a custom date field.
If the date field is empty first and then sorted form smallest to biggest date.


My try to cascade the order didn’t work well.
The sort field is referenced multiple times in the JQL sort and forced an error.


Thanks in advance
Cheers Ralf

2 answers

2 accepted

0 votes
Answer accepted
Ralf Monferrini
Contributor
January 11, 2024

Hello everyone

Unfortunately Jira does not support this kind of sorting.

One solution I haven't tested yet would be to introduce another variable for the empty fields and include them in the sorting.

We will see when this effort will be worthwhile to implement.

Thanks to all supporters, regards

0 votes
Answer accepted
Antuan Sammak
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.
December 7, 2023

Hi @Ralf Monferrini 

 

can you please share your query please for a better understanding.

usually what it takes to do the above is adding Sort by {{name of field}} to the end of your board query, however providing your query you are using and the error you have got would be helpful.

 

Thanks.

Ralf Monferrini
Contributor
December 12, 2023

Hi @Antuan Sammak 

Here my filter JQL
project = TEST ORDER BY cf[11111] DESC, status ASC, priority DESC, cf[22222]

cf[22222] is my date field 

Goal: First all empty issues then sorted by date started with the smallest value

Thanks a lot

Antuan Sammak
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.
December 19, 2023

Hi @Ralf Monferrini 

 

Apologies for not getting back to you earlier on this.

your query shall work with the below update

project = TEST ORDER BY cf[11111] DESC, status ASC, priority DESC, cf[22222] ASC

 

however, please note that ordering in your query follows the sequence of fields mentioned above.

so tickets will first be sorted in DESC based for cf[11111] then as per status then priority and last cf[22222]...in case cf[11111] this mixed ordering based on two date fields cf[11111] &&  cf[22222] will not work. only one date field can be in the sorting.

 

hope the above helps.

Ralf Monferrini
Contributor
December 21, 2023

Hi @Antuan Sammak _ FusionTech Innovations

Thanks for staying at the case.

I've testet your solution an my apologies, i have make a mistake.

The relevant field is cf[11111] desc at the beginning.
So i got all empty results at first.
But the followed ones are sorted (while using desc) biggest first.

I need them order smallest first after the empty results.

Goal:
2023-12-21 15_28_16-Mappe1 - Excel.png

Cheers Ralf

Antuan Sammak
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.
January 2, 2024

Hi @Ralf Monferrini 

 

Apologies for not getting back earlier to you on this but i was on holiday.

 

as far as i am aware, the built in behavior of Jira doesnt support that kind of sorting, when you are ordering based on a field then the empty ones will show in the beginning in case you use DESC. but if you use ASC then the empty ones will show last.

 

Hope the above helps.

Suggest an answer

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

Atlassian Community Events