We have several labels on issues in my project.
E.g. A, B, C, D, ...
I want to find the issues that have label A and only label A.
That is, I dont want to find any issues having A + another label. Just the ones with A only.
And I dont want to list all other possible labels and exclude them, as in the following query. ( labels=A and labels not in (B,C,D...) )
This is not a good solution when there are a huge amount of other labels.
Off the shelf, you can't do it.
It is possible with code, and I've seen two approaches before
1. A field that counts labels - your query becomes "labels = A and 'count of labels' = 1"
2. A JQL function - your query becomes "labels = A and labelCount() = 1"
Both of these are really easy to implement if you've got ScriptRunner installed, I've done the field one with my own code and SR, and seen SR create the function as well.
Thank you for your answer. I have not worked much with JIRA.
Have I understood you correctly that for 1) I have to create an new field. How do I get this new field to count number of lables?
I dont think we have ScriptRunner installed. I will check with the administrators.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct - a scripted field in scriptrunner can be really simple, I suspect it can be done in one line of code for counting labels.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I came across this thread and eventually came up with another solution for anyone still interested. What I did was create a separate structure (XYZ) that pulls the data I want to filter through. Then I add a Filter by Attribute according to exactly the labels I am interested in.
Then in the search section, I type in a JQL query issue in structure("XYZ"). Then save and now I have a saved filter showing only the labels I want. This workaround will be useful for people who don't have administrative permissions and cannot create new fields like me. Although I believe this uses the scriptrunner extension.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use
labels = LabelA AND !labels = LabelB AND !labels = LabelC AND !labels = LabelD
! = NOT
For me this returns tickets with labels on LabelA but not LabelC or LabelD
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Whatever I do, the labels don't show any results in the search. What could be the issue.
Regards,
Amna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That sounds like you have not added the column for labels to the issue navigator output?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it possible to do that in cloud jira without functions and additional plugins?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No. Jira does not offer this function out-of-the-box. You should consider using a custom field instead of labels.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am now trying to use:
issueFunction in issueFieldMatch("", "labels", "^A$")
but that doesnt work... Give no matches at all.
If I instead have:
issueFunction in issueFieldMatch("", "labels", "A")
ist find all issues with label A but also the issues with several labels.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think it's possible to write a query like this out-of-the-box.
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.