Changing the default order in the issue navigator without adding a sort by clause?

Hi,

It looks like the Issue navigator overrides the order of the issues returned by JQL queries by adding some default criteria.

of course, I can force the order by adding an ORDER BY <some value> clause, but is it possible to get the same order than the original returned by JQL functions?

Thanks,

Pablo

1 answer

0 votes

I'm a bit confused here. If you run JQL with "order by", it comes into the navigator. If you run it without, it uses the default. But what you're asking for is "the same order that the JQL returns it". But unless you put in an order by clause, JQL doesn't actually have an order, it's a list of issues. So what you're asking for is to order a list without specifying any order?

Yes, I would like the Issue Navigator respect the same order than the list.

A real case, The Links Hierarchy plugin exports all the issues in the tree:

issue in (AS-12,AS-4,AS-40,AS-65,AS-49,AS-50,AS-51,AS-52,AS-53,AS-54,AS-170)

by using the first-depth algorithm to get the issues in the hierarchy and make the issue key list above.

An user wants to see the same order AS-12, AS-4, etc in the Issue Navigator. Unfortunetely, there is not any custom field that can be used in the ORDER BY clause to get the "hierarchical" order, and the user gets an unexpected/undesired value.

You've missed my point. The list returned by JQL does not have an order.

You haven't said "order by", so you just get the unsorted list. It's irrelevant what the user typed in, JQL has no results order unless you add an order by clause (and that only kicks in when you're using something that uses it).

What you need to do is write a JQL function that allows you to say "order by what the user typed in". But I can see that getting immensely painful for complex or long queries.

The list returned by JQL does not have an order.

I do not agree. Below is the getValues standard function returning values for a JQL function:

public List&lt;QueryLiteral&gt; getValues(			 QueryCreationContext queryCreationContext, FunctionOperand operand,
			TerminalClause terminalClause){

...

}

It returns a java List object, so plugins can return ArrayList instances which are ordered. However, JIRA overrides this order at some point...

What you need to do is write a JQL function that allows you to say "order by what the user typed in". But I can see that getting immensely painful for complex or long queries.

Absolutelly agree. Even more, sometimes JQL results cannot be sorted by using an ORDER BY clause... another real example: Subversion ALM can return latest commits. It would be nice see them from newer to older in the Issue Navigator, however, JIRA overrides the order and users cannot sort by commit date as this is not a custom field, it is an internal data/attribute.

IMHO JIRA sould not re-order the results by default if an ORDER BY is missing or support some instructions/command/parameter to force the Issue Navigator to respect the original.

You're mixing up "sort" with "order". Java lists have an order, but that order is arbitrary and internal. They are NOT sorted. The very fact you have to move to an ArrayList to do any useful sorting is a bit of a giveaway here.

What I'm trying to get across is that the order the user types stuff in is not relevant to the sorting of the results. It would be painful and complex to impose that in all but the most simple of cases. Besides which, you have the option to add the order clause when you need it.

I have a similar issue. In my JQL function, I have sorted the results in the way I want to display to the user and then added to the QueryLiteral ArrayList. But the Issue Navigator ignores the sorted list and Orders all the results by default condition. Is there any way to show them the results in an sorted manner.

@Nic Brough [Adaptavist] / @Pablo Beltran [Kinto Soft] need your help!

I think it's the same answer as above - the issue navigator is coded to look for "order by" or whatever the standard sort order is.  Your function is giving it a list of issues to work with, but not the order, because you've done it inside the list, and not with an "order by" clause it can read.

Is there a way to give order to the Issue Navigator through JQL function programmatically?

Why am I asking ?: Because I am looking at 0% user involvement with the query.

E.g. User types the above query and exports/ analyzes / visualizes the results without having the need to type ORDER BY <Attribute>. Where most of the time, it is ordered by multiple attributes and the sequence also matters. I want that complex work to be done by the JQL function.

Again, it's coded to respond to an "order by" clause.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

467 views 7 5
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you