JQL Comment search - how to exclude some

Patricia Wiebe September 15, 2011

Hi,

I am trying to write a JQL search in JIRA 4.2.4 and it is not returning what I would expect.

Here's what I want to do.

Find the issues that contain the comment "This Issue has been sent to the Lab Director for approval" but do not also contain the comment "This Issue has been Approved by the Lab Director" and are not closed. There are multiple comments on each issue, and I need to find all the ones that contain one, but don't have the other.

I tried this:

comment ~"\"This Issue has been sent to the Lab Director for approval\"" AND comment !~ "\"This Issue has been Approved by the Lab Director\"" AND status != Closed

but it returns issues that do contain the second string.

I know my logic must be a bit off, but I can't seem to think this one out. Every angle I try still returns with ones with the second comment.

I have 8 issues with the first comment, and of the 8, 6 have the second comment, so I want the 2 without the second comment returned. I tried

(comment ~"\"This Issue has been sent to the Lab Director for approval\"" and status != Closed) and not (status != Closed and comment ~"\"This Issue has been Approved by the Lab Director\"")

thinking the first part of the query will give me the 8, and the second the 6, leaving me the 2, but it gave me all 8 again.

Can anyone shed some light on what I am missing?

Thanks!!

3 answers

1 vote
Andrzej Pasterczyk
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.
April 18, 2012

Hi,

I'm not sure if it will work but try the following approach.

Create a filter for first part and save it as test1

comment ~"\"This Issue has been sent to the Lab Director for approval\""

Create a filter for the second part and save it as test2

comment ~ "\"This Issue has been Approved by the Lab Director\""

Create third filter that combines them using filter

filter = test1 AND NOT filter = test2 AND status != Closed

Wil Holder August 19, 2016

I know that this is an old thread/comment but thank you Andrzej this is just what I was looking for after banging my head against not being able to use NOT with  'comment ~ "\"XYZ\"" '

0 votes
José ENCINA April 1, 2020

Hello there!

The filter is recognized as a good one by JIRA, but it is not allowing me to save the filters made.

Do you know if there are any changes with the new updates on JIRA?

Query used:

field1 = "VALUE NAME1" AND NOT filed2 = "VALUE-NAME2"

 Thanks in advance!

Darren Giles October 16, 2020

It's a typo... "filed2"

0 votes
Sadin Khan November 17, 2014

I had a similar problem and Andrzej's solution worked! Thanks!

Suggest an answer

Log in or Sign up to answer