Problem with query for issue types OR issue is EMPTY

Red Lloyd November 21, 2024

I'm running a query that seems simple - give me all tickets less than a week old that are specific issue types OR the issue hasn't yet been identified. The issue category is a custom one, so I'll just use XXX.

The query looks something like this:

project in (AAA, BBB, CCC) AND "XXX Issue Category" is EMPTY OR "MLS Issue Category" in ("Documentation Gap", "Known Error", "Product Defect") AND created >= -1w ORDER BY priority DESC, created ASC

If I run this without the EMPTY phrase, works fine.  When I add the EMPTY phrase, whether before or after the in () phrase, it returns basically every ticket in the database.

What am I missing or doing wrong??

1 answer

1 accepted

1 vote
Answer accepted
Harrison Ponce
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.
November 21, 2024

Hi @Red Lloyd , I would try throwing a parenthesis around your portions that have the OR statement. Try something like this:

project in (AAA, BBB, CCC) AND ("XXX Issue Category" is EMPTY OR "MLS Issue Category" in ("Documentation Gap", "Known Error", "Product Defect")) AND created >= -1w ORDER BY priority DESC, created ASC
Red Lloyd November 21, 2024

That worked, thank you so much! I'm not a database guy and it's been crippling at times :)

Like Harrison Ponce likes this
Harrison Ponce
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.
November 21, 2024

Haha no worries! It definitely can be tricky. The reason that the parenthesis are needed is that the JQL was interpreting your query quite literally as:

look for issues in Project AAA, BBB, CCC and those that have the empty category

OR (the rest of your query) in any project

So basically you have to nest stuff in parenthesis, especially with OR statements so that any criteria you want to carry throughout the entire search, will stick.

Hope that helps! It definitely gets easier with practice (and friends!) :-)

Like Red Lloyd likes this

Suggest an answer

Log in or Sign up to answer