Is the sequence of requests important in a JQL filter?
What do you mean by "sequence of requests"?
If you mean the order of the clauses and joins that you put into the question, then yes, it is important.
"A or B and C" is not the same as "A and B or C", nor "C or B and A"
When Jira is given unclear queries like those, it simply reads them left to right, so the order of clauses and joins matters.
The only thing that is really important is your usage of operators.
As long as your make sure your AND and OR's are correctly done (with brackets or not) the order of the statements does not matter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist- @Dirk Ronsmans Hi
If I have "or" in my request, then it applies further conditions only to the part after "or"?
For example, A and B and C or D and A and B.
That is, condition A and B and C will be fulfilled, if there are no corresponding signs, then it will go to condition D and check condition A and B again?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, without any grouping statements (using parentheses to explain the question logically), Jira, like all other standard compound search functions, just has to read left-to-right.
I'm going to simplify the writing down a bit, just to keep it short and readable, but I want to be clear on what I am doing here. We've been using phrases like "A and B", but the A and B are not really JQL. I want to be clear that A and B are shortened versions of JQL clauses like "priority = high" or "resolution is empty" - they will simply return a true or false for each issue.
There's no going back and looking at previous clauses, it simply joins what it has selected to the new clause with the and or or it finds next.
If your clauses are all joined with or OR and, then you have no problem - "A or B or C or D" can be written in English as "show me issues where A, B, C or D are true". With "and", it comes out as "show me issues where All four conditions are true"
Your query of "A and B and C or D and A and B" can be simplified to "A and B". This is because the first part of it "A and B and C" does what you expect, then the "Or D" adds issues matching D, but then "and A and B" requires the list to have A and B, as you read it left-to-right.
TLDR: use parenthesis to make it clear.
Never write "A and B or C" vs "A or B and C", even if reading left to right works for what you want the query to do. Be clear for your other humans - "A and (B or C)" or "(A and B) or C" do not need any thought to understand!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To simplify my questions, I came up with A or B. In this case, A (project status sprint) B (project status next sprint). If at least one condition in A is false, will it go to check B? Did I understand correctly?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No.
JQL is a logical statement that describes a state. It is not an algorithm or procedure that.
A or B means exactly what it says in English. If A is true, or B is true, then the issue is selected. Nothing is saying "if A is true, next look at B", it's a simple statement of the whole.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well, if you write the project and status and sprint or the project status and the next sprint. According to your logic, it should read from left to right. The project is true. status - true sprint - false means the request does not meet the condition, so we proceed to check that after or and then we issue the result if all three conditions are true. Is that how this logic works?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Ivan Andrieiev
Perhaps if you give a specific example of your exact JQL, and what you believe is not working as expected, the community can help.
Asking about JQL in the abstract will not help the community understand what you are asking or lead to clarifying answers.
Thanks, and kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>According to your logic, it should read from left to right. The project is true. status - true sprint - false means the request does not meet the condition, so we proceed to check that after or and then we issue the result if all three conditions are true. Is that how this logic works?
No, yet again, it is not a process or procedure, it is a statement about what you are looking for.
The project is true, the status is true, the sprint is true. It does not matter what order you evaluate those conditions in. If you join them all with "or", then the issue will be found if any of the three are true. If you join them with "and", then all three need to be true. If you join them with a combination of and and or, then it gets complex, and the order you write it in becomes important.
There is no "check the next bit", the logic reads the whole thing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough -Adaptavist- @Bill Sheboy
project = TESTPROJECT AND originalEstimate is not EMPTY AND status in ("In Progress", Reopened, Review, Open, Test) AND issuetype in (Development, Bug, Task) AND Sprint in openSprints() OR project = TESTPROJECT AND originalEstimate is not EMPTY AND status in ("In Progress", Reopened, Review, Open, Test) AND issuetype in (Development, Bug, Task) AND Sprint = 366 order by created DESC
I have such a filter, what is the logic of its operation. Because I understand that if there is "or", then condition 1 is checked, if one of its clauses is not fulfilled, then condition 2 is checked. Is this true?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Easiest is to really split it up visually.
project = TESTPROJECT AND originalEstimate is not EMPTY AND status in ("In Progress", Reopened, Review, Open, Test) AND issuetype in (Development, Bug, Task) AND Sprint in openSprints()
ORproject = TESTPROJECT AND originalEstimate is not EMPTY AND status in ("In Progress", Reopened, Review, Open, Test) AND issuetype in (Development, Bug, Task) AND Sprint = 366
order by created DESC
In this JQL an issue that falls under the condition of either the first part OR the 2nd part will be shown (and ordered by creation date)
Since everything in those parts is linked with an AND statement it needs to be valid under all those conditions.
This could be written a lot shorter tho..
project = TESTPROJECT AND originalEstimate is not EMPTY AND status in ("In Progress", Reopened, Review, Open, Test) AND issuetype in (Development, Bug, Task)
AND ( Sprint in openSprints() OR Sprint = 366)
Order by created DESC
since the first part of this query is the same for both and you only want to distinguish between the Sprint you could make it shorter like this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you do this, it will issue all the tasks in the sprint after "or", not taking into account the conditions, that's how it worked for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well no.. by using an AND condition before the sprints and enclosing the OR it will be one condition where either sprint condition will be evaluated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> I understand that if there is "or", then condition 1 is checked, if one of its clauses is not fulfilled, then condition 2 is checked. Is this true?
No. Both clauses are evaluated at the same time. There's no stepped procedure here, both clauses are checked.
An OR join does not do "If A = false, then evaluate B", it does "If either are true, then return true"
You need to stop thinking that this is procedural, it is not. Every clause is evaluated, whatever the rest of the clauses are returning.
If you want to think of it as procedural, then it's worth breaking down your query into single questions, as Dirk described earlier. If you stop thinking it as a procedure, then you will find you can write much more simple JQL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See Dirk's JQL he simplified for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.