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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Filter with brackets returns incorrect results

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

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

This give me the required results

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

But why?

Can somebody please explain the logic to me?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

227 views 1 6
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