How to build a JQL query with if statement

keren yerushalmi July 13, 2021

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

0 votes
Dave Bosman _Realdolmen_
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.
July 13, 2021

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.  

Regards

Dave

keren yerushalmi July 13, 2021

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))

Dave Bosman _Realdolmen_
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.
July 13, 2021

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. 

Regards

Dave

keren yerushalmi July 13, 2021

Ok, Thanks Dave

Suggest an answer

Log in or Sign up to answer