What JQL filter syntax is best for a couple of conditions?

Phil Bustin
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.
May 19, 2023

I have the following working Filter, but I'd like to know if there is a better way to specify multiple statuses; a status with parentheses in its name, and the condition [date field] = today. 

I thought there might be a more compact construct for the IN condition than the one I used, and a less arcane syntax for the date field = today condition than -0d.   

In order to get the filter to work, I changed the name of the status containing parentheses from "Approval (PR Tasks)" to "Approval - PR Tasks".

Working filter

project in (TAST6, PIN, "INT") AND issuetype = "Dev Story" AND (status = "Waiting for PR Move" or status = "Selecting PR Tasks" or status = "Approval - PR Tasks") AND "PR Move Req Date" = -0d order by "Create Date" ASC

 

2 answers

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 19, 2023

Hello @Phil Bustin 

For multiple status values use the IN operator. Example:

status in ("Waiting for PR Move", "Selecting PR Tasks")

 

If the statuses you want to check all belong to the same Status Category, and you want all statuses that are in that Status Category, then you could use the Status Category instead. Example: to get all issues that have a blue status (which is a status that is a member of the "In Progress" Status Category)

statusCategory = "In Progress"

 

To search for a status that has parentheses in the name simply enclose the status name in quotes.

status in ("status (with parens)")

To check for a date field against the current date you can use startOfDay(). Example

"PR Move Req Date" > startOfDay()
Phil Bustin
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.
May 22, 2023

Thank you. 

However, "PR Move Req Date" > startOfDay() yielded two issues whose PR Move Req Date values = May 26, 2023. 

 

Filter

Filter with startOfDay().jpg

 

Result: Issue with PR Move Req Date May 26th

Issue with PR Move Req Date less than today.jpg

 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2023

I'm sorry, my answer was incomplete.

If you want to get only the issues where the date field is set to today you need to use both "startOfDay()" and "endOfDay()".

"PR Move Req Date" > startOfDay() and "PR Move Req Date" < endOfDay()
Phil Bustin
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.
May 22, 2023

Thank you; that worked.

0 votes
Sankalp Chugh May 19, 2023

for current date, you can use "now" keyword.

EDIT:

My mistake, to use current date, make use of "startOfDay()" function.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events