This seems really simple and I think I have even done this before although it was probably the other way around where I was trying to find more than one issuetype. I'm working in Cloud. My search is this:
project in (EAM, MFG) AND "Applicable Project" = Gryphon19 OR labels in (Gryphon-19, Gryphon19, Strato-Radar) AND issuetype not in (Sub-task, Epic) AND status = Done ORDER BY key ASC, created DESC
Both this search and using issuetype = Task returns both Tasks and Sub-tasks but surprisingly not Epics which also exist.
Something I noticed with JQL this time that seems to make a difference in my results is the order of placement of the individual queries within the whole search function. I'm now wondering if there are guidelines for the order of operation.
It's down to the way the and and or operators work - I suspect your query is not joining the clauses in the way you think it is. And is pretty obvious - X and Y and Z does what you think, but when used alongside an and, OR becomes tricky - X and (Y or Z) is not the same as (X and Y) or Z.
Try these to see how the OR is doing things differently to the way you think:
( project in (EAM, MFG) AND "Applicable Project" = Gryphon19 ) OR (labels in (Gryphon-19, Gryphon19, Strato-Radar) AND issuetype not in (Sub-task, Epic) AND status = Done ) ORDER BY key ASC, created DESC
( project in (EAM, MFG) AND "Applicable Project" = Gryphon19 ) OR (labels in (Gryphon-19, Gryphon19, Strato-Radar) ) AND issuetype not in (Sub-task, Epic) AND status = Done ORDER BY key ASC, created DESC
Nic, you are the man. I think I see now how the order of operation of the search is critical. Cast the widest net first, then limit the filter in order of item needed. And I never even thought about using nested parenthesis in my search function. I will do some testing and see what I get.
LOL, somehow Nic I find it hard to believe you have trouble with OR & AND given how often I see your posts here in the community.
I'm really an engineering technician and not a software guy by trade except for LabVIEW. I had Jira brought in by someone else based on the recommendation of someone who is no longer here, and then had a "Jira expert" (read intern) set up a bunch of stuff w/o following good practices that I now have to clean up and manage. It's been eye-opening, to say the least, but after going through some online training I have been able to get a reasonable handle on things. I now get to struggle alongside my old school VP with learning agile/lean management.
Hi @Danno ,
In your query the OR operator is not grouped so your search returns concatenation of below 2 sets
You should put the OR into parenthesis as below.
project in (EAM, MFG) AND ("Applicable Project" = Gryphon19 OR labels in (Gryphon-19, Gryphon19, Strato-Radar)) AND issuetype not in (Sub-task, Epic) AND status = Done ORDER BY key ASC, created DESC
Thanks for the confirmation of the use of parentheses. I had read Nic's reply and had started a reply to him which I didn't send because I went off to try some quick changes to my search and see what the results were. I got interrupted and started doing something else altogether and then had to reboot my laptop and lost my response.
Suffice it to say I read Nic's reply which gave me the biggest clue that order of operation was critical. Here is my corrected search:
project in (EAM, MFG) AND issuetype in standardissuetypes() AND status in (Done, Closed, Complete) AND ("Applicable Project" = Gryphon19 OR labels in (Gryphon-19, Gryphon19, Strato-Radar)) ORDER BY key DESC, created DESC
This is what finally got me the results I wanted w/o the extra subtasks and Epics mixed in. It became quite clear that I was reeling those issue types into my net first and I didn't realize that you can't exclude them once they are in there. Another problem was I was trying to find the right combination of search items to use given I was digging through two completely different projects (One Next-Gen and one Core Business Project) with people using all kinds of labels and statuses as well as items that are resolved vs. unresolved.
Thank you @Nic and @Bloompeak Support for your help. I am still a real newbie with administering our entire Jira system which is a real WIld West show where we had multiple people creating their own way of doing things.
Consider it answered.