Groups ( .. )
Description
By default Expressions are evaluated from Left to Right (left associativity), so the following query:
Code Block | ||
---|---|---|
| ||
EntityType = Requirement OR EntityType = Incident AND Type = Bug |
Would be interpreted as:
Code Block | ||
---|---|---|
| ||
(EntityType = Requirement OR EntityType = Incident) AND Type = Bug |
But in the case above, our intention may be to include all requirements, but only those incidents which are of type bug - to force evaluation to occur in the correct order, you can surround parts of the expressions in round brackets (parentheses):
Code Block | ||
---|---|---|
| ||
EntityType = Requirement OR (EntityType = Incident AND Type = Bug) |
When using the pre-fix operator Not It's recommended that you should use groups to make the intention of the query clear.
So for example this expression:
Code Block | ||
---|---|---|
| ||
Not EntityType = Requirement OR EntityType = Script AND Project = 'Project X' |
Will be interpreted as:
Code Block | ||
---|---|---|
| ||
(Not (EntityType = Requirement OR EntityType = Script)) AND Project = 'Project X' |
This may not be your intention, or at least might be surprising. The way to resolve this is to surround the Not and the values it should operate on within a group e.g.
Code Block | ||
---|---|---|
| ||
(Not (EntityType = Requirement)) OR EntityType = Script AND Project = 'Project X' |