How to set operator priority in a quick filter when using AND and OR?
Asked by Jan Walsh:

I would like the following Quick Filter that includes both:

- issues of type "task" with any status

- issues of type "feature" with status "Ready to Dev"

I would expect this to work, assuming that the AND operator takes precedence over the OR operator:

*type in (Task) OR type in (Feature) AND status in ("Ready to dev")*

However, when I toggle the filter on my board, I only get issues of type "task".

I also tested adding parentheses like this:

*(type in (Task)) OR (type in (Feature) AND status in ("Ready to dev"))*

But I got the same result.

Is this kind of query possible with Quick Filters? What's wrong with query?


Answers:
author: Hana Ku?erov?
body: Hi [@Jan Walsh](/t5/user/viewprofilepage/user-id/2722491) ,

welcome to the Atlassian community.

Please use parentheses like this:

```
type = Task OR (type = Feature AND status = "Ready to dev")
```

comments: author: Bill Sheboy
body: Hi [@Jan Walsh](/t5/user/viewprofilepage/user-id/2722491) -- Welcome to the Atlassian Community!

Adding to Hana's suggestions:

To help learn more about the *order of operations* in JQL, please review this documentation and free training from Atlassian:

<https://support.atlassian.com/jira-software-cloud/docs/jql-keywords/>

<https://university.atlassian.com/student/path/849533-gain-project-insights-through-jql>

Kind regards,  
Bill


author: Jan Walsh
body: Hi [@Hana Ku?erov?](/t5/user/viewprofilepage/user-id/1226304)

Unfortunately, I have already tried (and just tried again) the query that you recommended.

Here is a screenshot before I save the Quick Filter:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/336031iB3ABA89D0B7909B4/image-dimensions/440x295?v=v2 "image.png")

Here is a screenshot after I click "Update":

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/336033iB66FCEEF278FF4B6/image-size/large?v=v2&px=999 "image.png")

As you can see, the parentheses aren't saved. When I open it again, the parentheses aren't there. And, when I refresh my board and use the filter, only tasks appear.

I confirm that I have issues of type "Feature" that should appear and to confirm this even more, a query like this \[type = Feature AND status = "Ready to dev"\] works to retrieve Feature issues with this status.


author: Hana Ku?erov?
body: Hi [@Jan Walsh](/t5/user/viewprofilepage/user-id/2722491) ,

you are right, the editor is removing the parentheses.

I've found out there have been issues with this behaviour in the past.

But, it works for me, even without the parentheses.

So, you are saying, that if you create three filters

1. type = Task
2. type = Feature and status = "Ready to dev"
3. type = Task OR type = Feature and status = "Ready to dev"

then when you use only the first one - all the Tasks show, the second one - all the Features with status "Ready to dev" show, but the third one shows only the Tasks?


author: Bill Sheboy
body: There are several places in Jira where it removes any parentheses entered. In some cases, it appears to automagically reorder the clauses to match the original intent...some times not so much.

The only workaround I have found is to ensure one orders the operators and clauses (perhaps adding extra ones) to ensure the Boolean order of precedence aligns with what is needed. I believe the order is:

1. NOT
2. AND
3. OR


author: Jan Walsh
body: [@Hana Ku?erov?](/t5/user/viewprofilepage/user-id/1226304) It turns out that the issues I want to filter by are not of type "Feature", but of type "Story". That was the problem!

Thanks for making me redo all these checks which allowed me to pinpoint the problem :)


author: Hana Ku?erov?
body: I'm happy to help :-)


author: Nikola Perisic
body: Hi [@Jan Walsh](/t5/user/viewprofilepage/user-id/2722491)

This query looks up for everything in the parantheses first then adds everything outside of parantheses.

> ```
> issuetype = Task OR (issuetype = Feature AND status = "Ready to dev")
> ```

comments: author: Jan Walsh
body: Hi [@Nikola Perisic](https://community.atlassian.com/t5/user/viewprofilepage/user-id/5166624),

Unfortunately, setting parentheses in the query is not saved when updating the Quick Filter. See my response to Hana's comment above.


Tags: cloud

jira-cloud

jira-service-management