Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

What's the issue?

Dann Williams November 25, 2021

Hi all,

I'm currently trying to filter all tickets, in specific projects, by age and making sure they are not in any completed or "green" status'. However, whatever I try doesn't seem to work.

My query is currently:

project = SmartVan OR project = Shops OR project = "BE Configurator" OR Project = "Product Data" AND created >= 2018-01-01 AND created <= 2021-01-01 AND status not in (Green, Done, Cancelled, Complete) ORDER BY created ASC

Even with this, it's still pulling tickets that are in the green AND all date ranges.

What am I doing wrong?

 

Thanks

3 answers

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
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.
November 25, 2021

Welcome to the Community!

When you mix OR and AND in a logical query, most humans will misunderstand how the computers will read it, and it's quite likely you have constructed a query that does not do what you think it will.

In short, you need to use parenthesis to make your question clear. 

Jira reads queries left to right when there are no clarifying parentheses, so what your question comes out in plain English is: 

Show me a list that includes

  • Issues in Smartvan
  • Issues in Shops
  • Issues in BE Configurator
  • Issues in Product data created between two dates and not having one of four status

A swift correction would be

(project = SmartVan OR project = Shops OR project = "BE Configurator" OR Project = "Product Data") AND created >= 2018-01-01 AND created <= 2021-01-01 AND status not in (Green, Done, Cancelled, Complete) ORDER BY created ASC

But a slightly easier one would actually remove the need for the parentheses:

project in (SmartVan, Shops, "BE Configurator", "Product Data") AND created >= 2018-01-01 AND created <= 2021-01-01 AND status not in (Green, Done, Cancelled, Complete) ORDER BY created ASC

Dann Williams November 25, 2021

Hi Nic,

Thanks for the explanation! Still new to the query side of Jira, but that makes more sense now!

Your code of...

project in (SmartVan, Shops, "BE Configurator", "Product Data") AND created >= 2018-01-01 AND created <= 2021-01-01 AND status not in (Green, Done, Cancelled, Complete) ORDER BY created ASC 

...worked great, so again, thanks for that! 

Like Nic Brough -Adaptavist- likes this
0 votes
Alexis Robert
Community Champion
November 25, 2021

Hi @Dann Williams , 

 

you'll probably need to add parenthesis around your query to make sure the "AND" and "OR" statements are in the right order : 

 

(project = SmartVan OR project = Shops OR project = "BE Configurator" OR Project = "Product Data") AND (created >= 2018-01-01 AND created <= 2021-01-01 AND status not in (Green, Done, Cancelled, Complete)) ORDER BY created ASC

 

Also, instead of "status not in xxx" I would suggest "resolution is not empty" as this will ensure that you only get issues that are opened (issues with no resolution are not closed).

Let me know if this helps, 

 

--Alexis

Dann Williams November 25, 2021

Hi Alexis,

Thanks for your response, it makes sense I needed more parenthesis!

 

Unfortunately, the "status not in<xxx>" was still drawing in Completed/Cancelled tickets, whereas I'm wanting to try and find tickets that are still historically backlogged/in progress/blocked - though, as I'm writing this I realise I could just search for those three criteria!

 

Thanks for the advice and help!

0 votes
Walter Buggenhout
Community Champion
November 25, 2021

Hi @Dann Williams and welcome to the community,

That issue relates to the fact that you use multiple OR statements in your filter. When you do, you need to group your conditions using brackets, so Jira knows what criteria you want to combine. You can rephrase your query like this:

Project IN (SmartVan, Shops, "BE Configurator", "Product Data") AND
created >= 2018-01-01 AND created <= 2021-01-01
AND status not in (Green, Done, Cancelled, Complete) ORDER BY created ASC

Hope this helps!

Suggest an answer

Log in or Sign up to answer