The logical parsing mode is used to construct logical expressions.
To construct these logical expressions, you can combine different elements, such as field codes, JWT expression parser functions and operators. The result must always return one of two distinct boolean values: true or false.
The main JWT features where you will be using the logical parsing mode are:
-
Conditional execution
- Logical condition
- Logical validator
- Boolean condition
- JWT JQL functions
Example comparison expressions
|
Parser expression |
Description |
|---|---|
|
This example returns:
|
|
This example returns:
|
Expressions can be combined or linked using operators to construct complex logical comparisons.
|
Parser expression |
Description |
|---|---|
|
This example returns:
|
|
This example returns:
|
Examples
|
Parser expression |
Description |
|---|---|
|
Simply returns false. You can use this expression for "switching off" a specific post function. |
|
A numerical comparison which returns true if the parent issue has more than 5 votes. |
|
A logical conjunction which takes two comparisons as operands. It returns true when the assignee of the issue is the project lead and if it's a Bug. The second expression has the same meaning but due to use of brackets may be more readable. |
|
Returns true if the issue does not have an assignee. This expression uses the null value as an operator. |
|
Returns true if the Priority has the value "Blocker" or "Critical". The first expressions uses a list whereas the second one uses single comparisons connected via the logical operator OR. |
|
Returns true if Affects version/s is set whenever the issue type equals "Bug". |
|
Returns true if Priority is "Blocker", "Critical" or "Major", the issue is assigned and Due date is set. |
|
Returns true if Labels (which is a field holding a text list ) contains "Blocker", "Critical" or "Major". |
Comparison operators
The operators, their meaning and the applicable data types you can use them with are listed below.
A comparison always returns a boolean value.
Overview of all case-sensitive comparison operators
All operators respect the case of the characters.
|
Operator |
Meaning |
Examples (all examples return |
|---|---|---|
|
|
equal to |
Bash
When working with Lists, each elements' existence and its order are being evaluated. |
|
|
not equal to |
Bash
When working with Lists, each elements' existence and its order are being evaluated. |
|
|
less than |
Bash
|
|
|
greater than |
Bash
|
|
|
less than or equal to |
Bash
|
|
|
greater than or equal to |
Bash
|
|
|
contains |
Bash
|
|
|
does not contain |
Bash
|
|
|
is contained in |
Bash
|
|
|
is not contained in |
Bash
|
|
|
any element is in |
Bash
|
|
|
no single element is in |
Bash
|
When comparing lists, the exact number of occurence (cardinality) per element must match.
|
Parser expression |
Output |
Description |
|---|---|---|
|
Bash
|
|
This expression returns |
|
Bash
|
|
This expression returns appear twice in the first list. |
Overview of all case ignoring comparison operators
The following comparison operators can be used with text and text list data types .
All operators ignore the case of the characters.
|
Operator |
Meaning |
Examples (all examples return |
|---|---|---|
|
|
equal to |
Bash
|
|
|
not equal to |
Bash
|
|
|
contains |
Bash
|
|
|
does not contain |
Bash
|
|
|
is contained in |
Bash
|
|
|
is not contained in |
Bash
|
|
|
any element is in |
Bash
|
|
|
no single element is in |
Bash
|
Applicable data types
Below you find a comprehensive matrix of all operators and applicable data types .
|
Comparison Operator |
BOOLEAN |
number |
Text |
number list |
text list |
issue list |
|---|---|---|---|---|---|---|
|
|
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
|
|
✅ |
✅ |
✅ |
✅ |
✅ |
✅ |
|
|
- |
✅ |
✅ |
- |
- |
- |
|
|
- |
✅ |
✅ |
- |
- |
- |
|
|
- |
✅ |
✅ |
- |
- |
- |
|
|
- |
✅ |
✅ |
- |
- |
- |
|
|
- |
- |
✅ |
✅ |
✅ |
✅ |
|
|
- |
- |
✅ |
✅ |
✅ |
✅ |
|
|
- |
- |
✅ |
✅ |
✅ |
✅ |
|
|
- |
- |
✅ |
✅ |
✅ |
✅ |
|
|
- |
- |
- |
✅ |
✅ |
✅ |
|
|
- |
- |
- |
✅ |
✅ |
✅ |
|
|
- |
- |
✅ |
- |
✅ |
- |
|
|
- |
- |
✅ |
- |
✅ |
- |
|
|
- |
- |
✅ |
- |
✅ |
- |
|
|
- |
- |
✅ |
- |
✅ |
- |
|
|
- |
- |
✅ |
- |
✅ |
- |
|
|
- |
- |
✅ |
- |
✅ |
- |
|
|
- |
- |
- |
- |
✅ |
- |
|
|
- |
- |
- |
- |
✅ |
- |
Please be aware the both operands of the respective comparison must have the same data type. The only exceptions are the following:
-
Automatic casting from number to text : Whenever you write a numeric term at the right-hand side of a comparison operator like =, and the left-hand side is occupied by a text term, the parser will automatically transform the right-hand side term into a text (e.g. "30" = 30 will be interpreted the same way as "30" = "30")
-
Single values as operand in list operations: Operators
~, !~, inandnot incan be used for checking a single element ( number or text ) against a number list or a text list -
Comparison with the null value: A field which is not set or an empty text is interpreted as null. A number field, which doesn't contain a number, is also interpreted as
null.
Things to remember
|
Remember |
Examples |
|---|---|
|
Operators |
Bash
|
|
Operators |
Bash
|
|
Operators |
Bash
|
|
Operators |
Bash
|
|
Operators |
Bash
|
Logical operators
The table below lists all logical operators that can be used for linking logical terms in an expression.
Logical operators take logical terms (which return boolean values) as operands and can thus be built using:
-
a boolean value
-
a JWT expression parser function returning a boolean value
-
a comparison
-
a logical term enclosed by brackets ()
-
two logical terms connected with a logical operator, where boolean literals and comparisons themselves are logical terms.
Logical operators can only be used in logical expressions in the Logical mode or in combination with the conditional operator.
Overview of all logical operators
|
Operator |
Meaning |
Precedence |
|---|---|---|
|
|
logical negation |
1 (highest) |
|
|
logical conjunction |
2 |
|
|
logical disjunction |
3 |
|
|
exclusive or, i.e., |
3 |
|
|
logical implication, i.e., |
4 |
|
|
logical equivalence, i.e., |
4 (lowest) |
A single logical term can be enclosed by brackets () in order to increase the readability of the expressions or to define a precedence which differs from the given one.
Logical operators can also be written in lower case (e.g. and , or )
Conditional operator
The conditional operator ? : is a powerful operator to construct conditional expressions.
It basically allows you to construct the following expression: IF logical_expression true THEN term_1 ELSE term_2.
<logical_expression> ? <term_1> : <term_2>
The conditional operator is extremely helpful when being used in calculated fields.
Examples of using the conditional operator
|
Expression |
Description |
|---|---|
|
IF the priority of an issue is Blocker, THEN this function will return "Please have a look at this issue immediately" ELSE it will return "No stress, come back later". |
|
IF an issue does have a due date set (due date is not null), THEN this function will return the number of hours from the current date-time to the due date ELSE it will return |
|
IF a custom field (e.g. a select list) has a value of Red, THEN this function will return "Color", ELSE it will return "No color". |
|
IF the current time is between 21:00 and 7:00 THEN this function will return "Night" , ELSE it will return "Day". |