Issues with JQL when trying to exclude issues with a certain parent

Alex Bryant February 20, 2020

I'm attempting to filter down a list of issues to a more manageable size by excluding the subtasks of a parent task that is of no relevance to me.

I'm running the following JQL:  

assignee = currentUser() and parent not in (SH-1) ORDER BY status

 Which returns 9 results. This seemed low so I changed the "not in" to an "in":

assignee = currentUser() and parent in (SH-1) ORDER BY status

Which returns 13 results. 

If i remove that clause altogether:

assignee = currentUser() ORDER BY status

I get 79 results. The same applies if replacing with = and !=.

My understanding of this if it were SQL would be that summing the results of an "in" and a "not in" would give the value of if the clause was not there at all. Is there any reason why this would not be the case for JQL? 

EDIT:

I think I've fixed my own issue by replacing the block with parent not in (SH-1 OR parent = null), should this not be implicit for a not in clause?

1 answer

1 accepted

1 vote
Answer accepted
Pete Singleton
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.
February 20, 2020

I'm not sure how you're using the "parent in" function, that must be from a plugin as I don't think it's standard JQL.  However, saying that, have you also checked for where Parent is not set at all?  They may give you the expected total.  

Something like "parent is empty" or "parent = '" "

Alex Bryant February 20, 2020

Yep I've just done parent not in (SH-1 OR parent = null) which is working, is there any reason a not in is not handling a null or is it likely a poor implementation of this as a custom field? 

Pete Singleton
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.
February 20, 2020

Not sure, it's the way JQL seems to work from my experience, an empty field has to be explicitly searched for.

Like Alex Bryant likes this
Alex Bryant February 20, 2020

Ok that's worth bearing in mind for the future, cheers for the speedy help.  

Suggest an answer

Log in or Sign up to answer