Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering labels is returning 0 issues

Some Guy
Contributor
August 28, 2024

Hi Community,

 

I try to find within one filter all issues with matches multiple criteria

a) If I search for

Project = XYZ AND NOT (labels = AAA AND labels = BBB AND labels = CCC)

I get some results

 

b) If I search for

Project = XYZ AND ((labels NOT IN (AAA, DDD)) OR (labels IS EMPTY))

I get 0 results, which is fine

 

c) But when I combine these two:

Project = XYZ AND 
((
(labels NOT IN (AAA,DDD))
OR
(labels IS EMPTY))
OR NOT (labels = AAA AND labels = BBB AND labels = CCC)
)

I also get 0 results, but it should be 20ish like in a)

 

I tried multiple combinations of brackets, switching to "OR (labels != AND...)" but it just does not work.

 

Anyone have a solution?

Thanks

 

 

 

4 answers

1 accepted

1 vote
Answer accepted
Some Guy
Contributor
August 30, 2024

First of all, thanks for your replies.

My query is a lot more complex and comprehensive than this example above.

I found an issue at another point in my query, but not it is working.

The suggestion with

NOT IN (AAA,BBB)

does not work. If it would have worked, I would have used it.

I have a particular project which has 3 labels, that should match, but only if one of the 3 labels is present. That's what I wanted to achieve, among other things, in one query:

(((labels NOT IN (AAA, DDD)) 
OR
(labels IS EMPTY))
OR
(labels = AAA AND (labels != AAA AND labels != BBB AND labels != CCC)))

This is finding all tickets, which have not labels AAA or DDD

Also all empty labeled tickets

and all tickets with labels AAA but not AAA+BBB+CCC

 

I even pushed it to the limit and added 2 more conditions to this one particular sub-query, which is well performing, not like I did it before with sub-filters.

 

Maybe this thread will help someone someday.

 

Have a good one

1 vote
Pears Whims
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 Champions.
August 28, 2024


Hi @some guy,

Let’s break down what your query is doing:

labels NOT IN (AAA, DDD)

This part excludes any issues that have labels AAA or DDD.

 

labels IS EMPTY:

This part includes any issues that have no labels at all.

 

NOT (labels IN (AAA, BBB, CCC))

This ensures issues with the specific combination of labels AAA, BBB, and CCC are excluded.

 

Effectively, it seems like your query might be excluding all labels except for the empty ones.

When this gets combined with other conditions using AND, it can be like multiplying by 0. Anything You multiply by 0 (results of AND) - results in 0, i.e. resulting in no results.

 

Important Points

The part where you use labels = AAA is very tricky.

This will only filter issues that have the exact label AAA and nothing else (no other labels).

It’s generally easier and more reliable to use labels IN (AAA) or labels NOT IN (AAA), which will include or exclude issues that may have AAA among other labels.

 

In case issue remains

In case this doesn't help.

Could you please clarify exactly what you need with the labels AAA, BBB, and CCC? I’d be happy to help further if you can specify what you’re trying to achieve.

In the meantime, I also recommend playing around with the filters - i.e. make changes and saving your progress as you troubleshoot the case.

This can make it easier to backtrack or refine your query as needed.

Best of luck,
Pears

Some Guy
Contributor
August 30, 2024

Important Points

The part where you use labels = AAA is very tricky.

This will only filter issues that have the exact label AAA and nothing else (no other labels).

It’s generally easier and more reliable to use labels IN (AAA) or labels NOT IN (AAA), which will include or exclude issues that may have AAA among other labels.

Thats exaclty, what I wanted to avoid, to find other tickets, which might have AAA among other labels, I want explicitly all tickets <see condition above>.

0 votes
karim -Atlassway-
Banned
August 30, 2024

Hi @Some Guy ,

 

It's usually simpler and more trustworthy to apply labels using IN (your_label) or NOT IN (your_label), as this approach will either incorporate or omit issues that could contain AAA along with other labels.
Otherwise try out Colored Label Manager , there’s absolutely no coding required and certainly no need to learn Jira Query Language (JQL) for that matter.

 

Atlassway

Karim

Some Guy
Contributor
September 12, 2024

Problem is, that I am no admin and cannot install any plugin

0 votes
Pasam Venkateshwarrao
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 Champions.
August 28, 2024

Hi @Some Guy 

 

Welcome to the community,Based on your query i understood that you want the issues which are not in the particular labels right.

you can try with this JQL i have tried it works so that iam sharing with you.

project = ABC AND labels NOT IN ("Label", USER_Group) ORDER BY created DESC

 

Suggest an answer

Log in or Sign up to answer