Groups ( .. )

Description

By default Expressions are evaluated from Left to Right (left associativity), so the following query:

EntityType = Requirement OR EntityType = Incident AND Type = Bug

Would be interpreted as:

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

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:

Not EntityType = Requirement OR EntityType = Script AND Project = 'Project X'

Will be interpreted as:

(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.

(Not (EntityType = Requirement)) OR EntityType = Script AND Project = 'Project X'

See Also

  • No labels