Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to build a JQL query with if statement

Need to filter all bugs - excluding some Held reasons I have on bugs in status on hold. 

problem is - when the bug moved to closed status, held reason is still populated and the filter is excluding those bugs. 

we need to exclude the bugs with specific held reasons only when in status "on Hold"

1 answer

Hi @keren yerushalmi 

When you write your query you can add ( ) around a part of the query, this will handle the part within the brackets as a priority. And offcourse you can use "AND" and "OR" statements to complete the rest of the query.

Assignee = dave AND (reporter = keren OR issuetype = epic)

is not the same as 

(Assignee = dave AND reporter = keren) OR issuetype = epic

Both queries will provide a different result. and i believe that when you create your queries in a similar way like this, it will solve your issue. At least if understood your question correctly.  



Thanks Dave for the quick replay 

but it doesnt solve my issue, I need  - to exclude the held reason only when status is on hold, but that the filter will include all statuses 

 this is the query i did - but it is wrong it is not excluding the bugs with held reason i wanted to exclude 

project = CMAEGON AND issuetype = "Customer Bug" AND "Project Stream" in ("EB – Unisure", "All") AND ("Held Reason" not in ("Awaiting Customer Retest", "Awaiting Customer WG Decision", "Awaiting for CR", "Customer Info Awaited", "Pending Customer Approval", "Rejected Candidate") OR status in (Open, "In Analysis", "In Review", "IN PROMOTION", "In Test", "On Hold", Closed, "Ready To Promote",REJECTED))

You need to rewrite your query. 

Basically, create a query for everything exept for your exeption. 

A second query for your exception

And then combine them (each query in brackets ( ) ) with  an or statement between them. 



Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you