Forums

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

Help with JQL query

Deleted user November 19, 2018

dwdwdwqwqd

3 answers

0 votes
Deleted user November 19, 2018

@Tom Lister @Seth Unfortunately, I do not have the opportunity to edit thjis query, I just have to answer the following questions, so in this case, what was your answer to questions 1 and 2? 

Tom Lister
Community Champion
November 19, 2018

Difficult to prove unless you can run and examine results.

I think the syntax allows Jira to decide precedence of clauses which is probably not what I think you want.  i.e. you will get items in status Open for devs.

IMHO your query should look like to give you results of both sub-queries in one report

(project in ("Lotto ") AND status in (Closed, Resolved, "In testing") AND fixVersion > latestReleasedVersion()) 

AND
(project = "QA Lotto" AND status in ("In Progress", Closed, open)
AND fixVersion > latestReleasedVersion()

)

ORDER BY key ASC

I would ask whoever owns it to write two queries that provide the sub-sets of results require and then investigate how to merge them.

Deleted user November 19, 2018

@Tom Lister I had these two questions 

  1. Results show unfinished tasks for devs? Why?

  2. Are we going to see bugs that were fixed in initial version? Why?

on interview and I wonder how to answer them correctly. So according to you the whole question is written incorrectly and should be divided? 

If you were to receive these questions without being able to check the design, you would only have to answer what you would say?

For me for first question correct answer is: results will shown unfinished tasks for devs because  we  will get items in status Open for devs.

And second "Are we going to see bugs that were fixed in initial version? Why?"

Yes, because we have filter by Resolved and fixVersion > latestReleasedVersion()

i'm right ?

0 votes
Seth
Contributor
November 19, 2018

I think everything is working as designed, but there are a few aspects that are causing you some confusion. Let me address things one at a time.

First, quotes (") - JQL requires quotes around values that have spaces (and maybe certain special characters). For a value that is a single word (Closed, Resolved) they aren't required.

The bigger confusion is regarding the meanings of AND and OR - these function according to common programming meanings, and they are applied to individual issues. So when you say "the query after OR will only be executed if the question before OR does not result in a result" - this is totally incorrect. Let's call the first half or your query "Lotto Done" and the second half "QA Unfinished". In common terms, the query will show Lotto Done issues and  QA Unfinished issues. In programming terms, it will show any issue that is either  Lotto Done OR QA Unfinished.

Regarding versions, for the query as written, the "fixVersion > latestReleaseVersion()" is only applying to the "Lotto Done" tasks. The "QA Unfinished" tasks will be for all fixVersions.

I don't think you can write a query that only shows issues from one clause if there are no results for another - you just need two separate queries. You may need the fixVersions clause in both, depending on what you're going for.

Hopefully I understood you correctly and made some sense.

Tom Lister
Community Champion
November 19, 2018

Hi

There is also an option to write both queries as saved filters. Then add a third filter based on those results

e.g. JQL

filter = "Filter for cool" or filter = "Filter for FRO board"

where the quoted strings are saved filter names.

0 votes
Tom Lister
Community Champion
November 19, 2018

Hi @[deleted]

If your sub queries are meant to operate separately, enclose them in brackets. 

(project in ("Lotto ") AND status in (Closed, Resolved, "In testing") AND fixVersion > latestReleasedVersion()) 

OR (project = "QA Lotto" AND status in ("In Progress", Closed, open))

ORDER BY key ASC
Deleted user November 19, 2018

@Tom Lister whether the statuses should also be in quotation marks ? 
and are my answers correct for these questions?

Tom Lister
Community Champion
November 19, 2018

Hi

Your syntax is correct. Statuses that are not one word should be included in quotes and match the status exactly.

You can just start with status in () and when you start to key in statuses, JQL intellisense will suggest correct values.

is open open or Open?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events