Filter with brackets returns incorrect results

Ian C_ August 16, 2020

I've read the "Advanced searching" help article and specifically example 1 of the precedence section.

The results of my query do not exclude "Resolved" or "Closed" tickets. How do I need to reword this query? I want to get a list of tickets that still need work to be done on them, regardless of the current status. Tickets with a status of "Resolved" or "Closed" do not need any work done on them.

assignee = currentUser() AND summary ~ "bla bla bla" and (status != Resolved OR status != Closed) order by key desc

If I remove the brackets and either `status !=` query, I get the expected results. In the below screenshot, the green "Closed" status should not be part of the results returned.

Atlassian - JQL results.png

3 answers

1 accepted

1 vote
Answer accepted
Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 16, 2020

Hi @Ian C_ 

The issue is the OR within the parentheses.

This way JQL reads your original JQL is that it should include issues which are either not in Resolved (i.e Closed issues) OR issues which are not in Closed (i.e Resolved Issues). You're almost cancelling out the search limitation.

---------------------------

Your original JQL would work if you changed the OR to an AND:

assignee = currentUser() AND (status != Closed AND status != Resolved)

^ That way, JQL reads it that issues should not be either status - rather than either/or. This is the same effect as using NOT, like in your second query.

The cleaner option is to use NOT IN - which aligns the same action to all issues within the parentheses:

assignee = currentUser() and status NOT IN (Closed, Resolved)

---------------------------

Another alternative for incomplete issues is to filter by resolution - i.e issues with no resolution:

assignee = currentUser() and resolution IS EMPTY

And further, if you want to filter out all statuses with a status category of Done (i.e green statuses) you could use:

assignee = currentUser() and statusCategory != Done

---------------------------

Lots of options for status - but in general - NOT IN is a good option for removing multiple options from the same field in JQL searches.

Ste

0 votes
Ian C_ August 16, 2020

But why?

Can somebody please explain the logic to me?

0 votes
Ian C_ August 16, 2020

This give me the required results

assignee = currentUser() and summary ~ "bla bla bla" and not (status = Resolved OR status = Closed) order by key desc

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events