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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Some Guy ,
Atlassway
Karim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.