Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

JIRA Query > Missing items where component is Empty

I'm running into a query problem that I feel is a bug in JIRA's query language, but I am hoping I am wrong.  Given the below query, the first line builds up a list and the 2nd should be filtering it down, which it does, but not as designed.

(filter = 23266 OR project in (WD, WC)) AND NOT
(component in (PBE) AND assignee is EMPTY)
ORDER BY Rank

My expectation for the above is that 2nd line would remove items found in the first line where the component is PBE and the assignee is EMPTY.  It does this, but it is also removing items where the component is EMPTY and the assignee is EMPTY.  Why?

1 answer

0 votes

It's a quirk of logic that humans find counter-intuitive, but when a multi-select field has nothing to work with when you say "field has X", it does not match.  Null is not something you can compare with a value.

When you say "component in PBE", that clause ignores all empty components, because there is nothing for it to compare PBE with.

Try:

(component in (PBE) or component is empty) AND assignee is EMPTY

I tried this:

(filter = 23266 OR project in (WD, WC)) AND NOT
((component in (PBE) or component is empty) AND assignee is EMPTY)
ORDER BY Rank

And I'm getting the same issue.

The above actually makes sense based on the result I'm getting back as it is saying take line 1 and remove anything where the assignee is empty and the component is empty or set to PBE.  

I want the ones where assignee is empty and component is empty to remain, not be pulled out.

The only "Hack" workaround I can think of currently is to remove the null case from the mix and require a Component set.  Possibly setting something up in automation to populate it.  But also, gross.

Ok, I think I misunderstood the question that you're trying to ask.

"Not" is quite a difficult thing for humans to process, and they can make building queries a lot harder to construct and read.  Ideally, use them sparingly

Don't think about "taking away from another line" when you're building queries, always start with "how do I select what I want to see".

Having re-read your comments, I think it might be worth rephrasing the question, and hence the JQL.

I think you could break down your query into:

  • The easy bit that doesn't need any attention: (filter = 23266 OR project in (WD, WC))
  • And the assignee is empty
  • And then please exclude issues with a component of PBE or not having a component at all

If that is the right question, then, the query becomes more intuitive:

(filter = 23266 OR project in (WD, WC)) and assignee is empty and not (component = PBE or component is empty)

I know that'll give the result for the question I've just re-written, but have I rephrased the question correctly now?

No I don't think you have.  Here is what I want:

  • I want everything from (filter = 23266 OR project in (WD, WC)), but: 
    • I do NOT want the ones where assignee is empty and component is PBE.
    • I do want the ones where assignee is empty and component is empty.
    • I do want the ones where assignee is set and component is PBE.

Ok, great, having it spelt out makes it easy to understand, and it's simple to get rid of the "not", making it the resulting query easier to understand.  For this one, you can just forget the "I don't want" by just not selecting for it.

Try 

(filter = 23266 OR project in (WD, WC)) And ( (assignee is empty and component is empty) or (assignee is not empty and component = PBE) )

Suggest an answer

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

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

587 views 21 25
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