How to select not done Jira tickets for a sprint but exclude certain epic and label?

Sarfraz Aaron December 5, 2022

Hi,

I am trying to write JQL that will allow me to select all those Jira tickets for the current active sprint that are not done and excludes certain epic (A-123) and label (XZY). 

This is what I have and it is not working.

Project = ABC AND Status != Done AND 'Epic Link' != A-123 OR Labels != XZY

 

Please help.

2 answers

2 votes
Marta Woźniak-Semeniuk
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 Leaders.
December 5, 2022

Hey, try this:


Project = ABC AND Status != Done AND (('Epic Link' != A-123) OR (Labels != XZY)) AND sprint in openSprints () ORDER by Rank DESC

 

You had the OR part not but in brackets so it could give weird results - you specify you want issues from active sprints by telling JQL - get me issues in openSprints only :) 

 

Let me know if it works.

Sarfraz Aaron December 5, 2022

Thanks Marta. It did not work as my example had:

  • 12 issues in current active sprint
    • 1 issue with epic=A-123
    • 1 issue with label=XZY
    • 1 issue done

So the outcome should have been:

9 issues (out of 12)  left to do (12 - 3 = 9) , instead, I got 6 issues left to do....

Ismael Jimoh
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 Leaders.
December 5, 2022
(project = ABC and status != Done and sprint = '<your sprint id>' AND (('Epic Link' != 'A-123') OR (Labels != 'XZY')))


I am surprised that the suggestion from @Marta Woźniak-Semeniuk  above didn't work. Looking at your request, I would then search with the above structure.

If you still do not get what you want, then my suspicion is either, you have tickets that you believe match a specific parameter but do not and in this case, searching phase by phase (adding the next set of parameters after validating the prior returns the list of issues expected first) would be the way to go.

Regards.

Sarfraz Aaron December 5, 2022

Thank you @Ismael Jimoh 

Jira version I am using, a free version online, converts the query to this and gives the wrong result as mentioned above. It removes the brackets.

I don't add project as it is a quick filter on a Jira board.

status != Done AND sprint in openSprints() AND ("Epic Link" != HTS-5 OR Labels != Client)

Marta Woźniak-Semeniuk
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 Leaders.
December 6, 2022

status != Done AND sprint in openSprints() AND ("Epic Link" != HTS-5 AND Labels != Client) ORDER by Rank DESC

 

try this :)

Like Ismael Jimoh likes this
Sarfraz Aaron December 7, 2022

Thank you again. I did try and it gave me the wrong result. Also the brackets were removed by Jira.

Marta Woźniak-Semeniuk
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 Leaders.
December 7, 2022

Okay if you are using it as a quick filter for the board then the “sprint in openSprints()” part is obsolete as by default only current sprint tickets are visible.

Then it would leave
“status != Done AND “Epic Link” !=HTS-5 AND labels not in (Client)”
If the above is till giving wrong results, what is wrong with the results - does it show the done tickets too or the problem is with the epic/label?

Ismael Jimoh
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 Leaders.
December 7, 2022

Hi Safraz,

If this is failing, then it could mean the logic you have in mind and what you expect are not matching.

As we have no access to the tickets, I will go with my original suggestion of adding the next condition after validating that what you currently see is what you expect to see.

The question is which ones are failing. For example, with the current search, you will not get issues where Epic link is empty.

Here is a sample query I built that you can adjust:

project = "Sample scrum project" and Sprint in openSprints() and status != done and (("Epic Link" != SSP-7 or "Epic Link" is EMPTY) or labels != l1)

 

I had 3 issues, where one had the label mentioned, the other had the epic link mentioned and the 3rd had neither.

I successfully get just one ticket back.

Sarfraz Aaron December 7, 2022

I am using this query as a quick filter:

status != done AND ("Epic Link" != HTS-5 OR "Epic Link" is EMPTY OR labels != Client)

 

I have:

  • 12 issues
    • 1 done
    • 2 labels=Client
    • 1 epic=HTS-5

Should expect:

8 back but getting 10 instead (i.e. Labels are not working)

Marta Woźniak-Semeniuk
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 Leaders.
December 8, 2022

I think the != for labels might be the issue, there was a thread in the community about it once. Let's try with the 


status != done AND ("Epic Link" != HTS-5 OR "Epic Link" is EMPTY OR labels not in (Client))

0 votes
Ismael Jimoh
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 Leaders.
December 5, 2022

Hi @Sarfraz Aaron 

Is the Or operation checking if the issues are a part of the epic or are matching the epic.

Use brackets to combine and order operations in the order you want the search to be performed.

Ismael Jimoh
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 Leaders.
December 5, 2022

Another option would be building your query and validating you have the write list of issues first and then adding the next operator and conditions to filter down further

Sarfraz Aaron December 5, 2022

Hey @Ismael Jimoh the epic and the label are used together to isolate this particular vendor, as an example, where I have issues for the vendor epic or sometimes the issue belongs to another epic but has the vendor label to distinguish it.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events