Forums

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

jQuery to filter issues containing exactly certain labels

Shiva Kanou July 7, 2023

I wrote the following jQuery:

project = X AND issuetype = "Test Plan" AND labels in (A,B)

When I run it, it returns me issues that have either A OR B, but I want A AND B. I was able to get around modifying it to:

project = X AND issuetype = "Test Plan" AND labels = A AND labels = B

Although it works I was wondering if "IN" should bring only issues that have both A AND B. I remember running this same query in other jiras and I'm almost sure it'd work.

Could you please confirm this information?

2 answers

1 accepted

2 votes
Answer accepted
Evgenii
Community Champion
July 7, 2023

Hi, @Shiva Kanou 

When you use IN, JQL searches for next issues, where at least one of values exists:

  • where one of labels = A
  • where one of labels = B

When you search with JQL labels = A AND labels = B, it's strict condition, that issue must have both labels.

Shiva Kanou July 7, 2023

Oh ok, thank you!

2 votes
Mohamed Benziane
Community Champion
July 7, 2023

Hi,

Welcome to the community

The keyword in will bring you issue that have only A or b or both of them.

Shiva Kanou July 7, 2023

Thank you very much. The support staff at my company kept saying it would bring either A or B.

Mohamed Benziane
Community Champion
July 7, 2023

Create two issue, one with 2 labels(foo, bar) and an another one with only one label (foo).

make you jql

labels in (foo, bar)

you will see the two issue brought by this jql

Shiva Kanou July 7, 2023

The issue is that it's bringing other issues also. The query says A AND B, but it's bringing:
A AND C
B AND D
A
B

A AND B

 

It's like OR, you know?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events