I'm running into a query problem that I feel is a bug in JIRA's query language, but I am hoping I am wrong. Given the below query, the first line builds up a list and the 2nd should be filtering it down, which it does, but not as designed.
(filter = 23266 OR project in (WD, WC)) AND NOT
(component in (PBE) AND assignee is EMPTY)
ORDER BY Rank
My expectation for the above is that 2nd line would remove items found in the first line where the component is PBE and the assignee is EMPTY. It does this, but it is also removing items where the component is EMPTY and the assignee is EMPTY. Why?
UPDATE
Although I'm not entirely satisfied with the solution, it turns out this was an issue with my understanding of the use of NOT. The solution involved asking for everything I wanted instead of asking to leave out the one thing I didn't want. Makes for a pretty ugly query. Is a shame JQL does not handle this situation better.
(filter = 23266 OR project in (WD, WC)) AND (
(component is EMPTY AND assignee is EMPTY) OR
(component is EMPTY and assignee is not EMPTY) OR
(component != PBE AND assignee is not EMPTY) OR
(component != PBE AND assignee is EMPTY) OR
(component = PBE AND assignee is not EMPTY)
) ORDER BY Rank
It's a quirk of logic that humans find counter-intuitive, but when a multi-select field has nothing to work with when you say "field has X", it does not match. Null is not something you can compare with a value.
When you say "component in PBE", that clause ignores all empty components, because there is nothing for it to compare PBE with.
Try:
(component in (PBE) or component is empty) AND assignee is EMPTY
I tried this:
(filter = 23266 OR project in (WD, WC)) AND NOT
((component in (PBE) or component is empty) AND assignee is EMPTY)
ORDER BY Rank
And I'm getting the same issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The above actually makes sense based on the result I'm getting back as it is saying take line 1 and remove anything where the assignee is empty and the component is empty or set to PBE.
I want the ones where assignee is empty and component is empty to remain, not be pulled out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The only "Hack" workaround I can think of currently is to remove the null case from the mix and require a Component set. Possibly setting something up in automation to populate it. But also, gross.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I think I misunderstood the question that you're trying to ask.
"Not" is quite a difficult thing for humans to process, and they can make building queries a lot harder to construct and read. Ideally, use them sparingly
Don't think about "taking away from another line" when you're building queries, always start with "how do I select what I want to see".
Having re-read your comments, I think it might be worth rephrasing the question, and hence the JQL.
I think you could break down your query into:
If that is the right question, then, the query becomes more intuitive:
(filter = 23266 OR project in (WD, WC)) and assignee is empty and not (component = PBE or component is empty)
I know that'll give the result for the question I've just re-written, but have I rephrased the question correctly now?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No I don't think you have. Here is what I want:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, great, having it spelt out makes it easy to understand, and it's simple to get rid of the "not", making it the resulting query easier to understand. For this one, you can just forget the "I don't want" by just not selecting for it.
Try
(filter = 23266 OR project in (WD, WC)) And ( (assignee is empty and component is empty) or (assignee is not empty and component = PBE) )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help on this Nic. The above solution is still not quite right. It misses items where the component is something other than PBE and the assignee is not empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So this illustrates what I'm going for. I think there is an answer here based on your solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist- - So I think I have a modified solution based on yours and the grid above. It's not pretty, but it does do what I was looking for:
(filter = 23266 OR project in (WD, WC)) AND (
(component is EMPTY AND assignee is EMPTY) OR
(component is EMPTY and assignee is not EMPTY) OR
(component != PBE AND assignee is not EMPTY) OR
(component != PBE AND assignee is EMPTY) OR
(component = PBE AND assignee is not EMPTY)
) ORDER BY Rank
It for sure feels like more than would be necessary for such a thing. It's a shame JQL does not support filtering the results of another query.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.