We are trying to clean up the labels used on a project; I would like to find a way to see a list of issues that have a label that is NOT in a set of labels that I specify.
For example, I want to find all issues that have any label that is not one or more of (foo, bar). Some issues might have 2 labels, such as (foo, zing). I need to find all issues that contains any label that is not foo or bar.
Thanks, but that doesn't work either. In this case, it won't find an issue with (foo, zing) because the labels comparison, apparently, matches ANY label on a task. Here, if I want to find any issue with zing, but filter on (labels != foo AND labels != bar), an issue containing foo will cause the AND construct to return FALSE. (By Jira's behavior, labels does = foo.)
Hang on, that's not what you asked for.
"I want to find all issues that have any label that is not one or more of (foo, bar)"
The search "label != foo and label != bar" will exclude those, and all you need to do then is add "and label is not empty". That will answer the question presented.
Or is the original question not quite right?
Thanks for circling back, but I'm not quite sure how else to frame the question.
At a high level, I want to find a list of issues that contain any label not in a list of "approved" labels. In my example, I want to find any issue that contains any label other than "foo" or "bar", but I won't know what "unapproved" labels someone might have entered. If someone applied the "zing" label, I need to find it. (Logically, I need to express "issue has any_label NOT one of [foo, bar]".)
With your suggested test, it won't find (foo, zing), since it will fail the "label != foo" comparison.
Does this clarification help?
Ah, yes, I think it explains what I was not getting.
You don't care if foo or bar are on the issue, you want to find issues that have a label other than foo or bar.
In Jira terms, the starting point is "labels is not empty". But then you want to exclude issues where the labels are only foo, bar or foo and bar.
I can't think of a neat way to to that, because the logic of "not" means you get "not <statement>" not "not <isolated statement>"
Yup, that's it.
I'm beginning to suspect what I want to accomplish isn't possible using JQL.
Someone suggested doing an export of the issue list, and running a script over that, to find the issues that contain "unapproved" labels. That's my last resort. If anyone else has any other outside-the-box solutions for my use case, that would be most appreciated.
I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...
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