Comparison operatorsThe operators and their meaning are listed below - the applicable data types for the elements (operands) of the respective operators can be found in the subsequent table. A comparison always returns a value. |
All operators respect the case of the characters. |
Operator | Meaning | Examples (all examples return true ) |
---|
= | equal to |
1=1
true = true //comment
[1, 2, 3] = [1, 2, 3] |
["blue", "red", "green"] = ["blue", "red", "green"] |
When working with lists, each elements' existence and its order are being evaluated. |
| != | not equal to | 0 != 1 "HELLO" != "Hello" %{issue.description} != "Hello" true != false [1, 2, 3] != [1, 3, 2] ["blue", "red", "green"] != ["blue", "green", "red"]
When working with lists, each elements' existence and its order are evaluated. |
| < | lower than | 1 < 2 "abc" < "bbc" "abc" < "abcd"
| > | greater than | 2 > 1 "bbc" > "abc" "abcd" > "abc"
| <= | less than or equal to | | >= | greater than or equal to | "Hello world! Hello *" >= "Hello world"
| ~ | contains | "Hello world!" ~ "world" , checks whether a string contains a substring.%{issue.components.leads} ~ %{system.currentUser} , checks whether "Component leads" contains "Current user".[1, 2, 3, 2, 2, 4] ~ [2, 1, 2] , when used with lists cardinalities of every single instance of an element must match.["blue", "red", "green", "red", "white", "red"] ~ ["red", "green", "red"] (["green", "red"] ~ ["red", "green", "red"]) = false
| !~ | does not contain | "world" !~ "Hello world!" %{issue.fixVersions} !~ %{issue.versions} , checks whether "Fix version/s" doesn't contain all versions in "Affects version/s".[1, 2, 3, 2, 2, 4] !~ [2, 1, 1, 4] , when used with lists cardinalities of every single instance of an element must match.["blue", "red", "green", "red", "red"] !~ ["red", "green", "green", "red"]
| in | is contained in | "world" in "Hello world!" , to check whether a substring is contained in a string.
%{system.currentUser} in %{issue.components.leads} , checks whether "Current user" is contained in "Component leads".
[1, 1, 2] in [2, 1, 1, 1, 4] , cardinalities of every single element must match.
["blue", "red", "red"] in ["red", "green", "blue", "red", "red"] , cardinalities of every single instance of an element must match.
2 in [1, 2, 3]
"blue" in ["red, "blue", "white"] | not in | is not contained in | "Hello world!" not in "world"
%{issue.versions} not in %{issue.fixVersions} , checks whether not all versions in "Affects version/s" are contained in "Fix version/s".
[1, 1, 2, 2] not in [2, 1, 1, 1, 4] , cardinalities of every single element must match.
["blue", "red", "red", "blue"] not in ["red", "blue", "red", "red"] , cardinalities of every single instance of an element must match.
5 not in [1, 2, 3, 3, 4]
"orange" not in ["blue", "red", "white"] | any in | some element is in | %{issue.versions} any in %{issue.fixVersions} , checks whether any version in "Affects version/s" is contained in "Fix version/s".
[1, 3] any in [3, 4, 5]
["blue", "white"] any in ["black", "white", "green"] | none in | no single element is in | %{issue.versions} none in %{issue.fixVersions} , checks whether there isn't a single version "Affects version/s" in "Fix version/s".
[1, 2] none in [3, 4, 5]
["blue", "red"] none in ["black", "white", "green"] |
|
The following comparison operators are applicable to and data types. All operators ignore the case of the characters. |
Operator | Meaning | Examples (all examples return true ) |
---|
=~
| equal to |
"HELLO" =~ "Hello"
"up" =~ "UP"
["blue", "red", "green"] =~ ["Blue", "RED", "Green"]
|
!=~
| not equal to |
" HELLO" !=~ "Hello"
"up" !=~ "down"
("up" !=~ "UP") = false
["blue", "red"] !=~ ["Blue", "green"]
["blue", "red"] !=~ ["Red", "BLUE"]
(["blue", "red", "green"] !=~ ["Blue", "RED", "Green"]) = false
|
~~
| contains |
"Hello World!" ~~ "world"
, checks whether a string contains a substring.
"A small step for a man" ~~ "STEP"
, checks whether a string contains a substring.
["one", "two", "three"] ~~ ["TWO", "One"]
, checks whether a string list contains all the elements of another string list. |
!~~
| does not contain |
"Hello World!" !~~ "bye"
, checks whether a string doesn't contain a substring.
"A small step for a man" !~~ "big"
, checks whether a string doesn't contain a substring.
["one", "two", "three"] !~~ ["Four"]
, checks whether a string list doesn't contain one element of another string list.
(["one", "two", "three"] !~~ ["TWO"]) = false
|
in~
| is contained in |
"world" in~ "Hello World!"
, checks whether a substring is contained in another string.
"STEP" in~ "A small step for a man"
, checks whether a substring is contained in another string.
["TWO", "One"] in~ ["one", "two", "three"]
, checks whether all the elements of a string list are contained in another string list. |
not in~
| is not contained in |
"bye" not in~ "Hello World!"
, checks whether a substring is not contained in another string.
"big" not in~ "A small step for a man"
, checks whether a substring is not contained in another string.
["Four"] not in~ ["one", "two", "three"]
, checks whether any of the elements of a string list are not contained in another string list.
(["TWO"] not in~ ["one", "two", "three"]) = false
|
any in~
| some element is in |
["blue", "violet"] any in~ ["Blue", "Red", "Green"]
["Five", "One"] any in~ ["FOUR", "FIVE", "SIX"]
|
none in~
| no single element is in |
["Orange"] any in~ ["red", "blue", "green"]
(["orange"] any in~ ["Red", "Orange"]) = false |
|
Below you find a comprehensive matrix of all operators and applicable data types. |
Comparison Operator | | | | | | | |
---|
=
| | | X | X | X | X | X |
!=
| X | X | X | X | X | X | X |
<
|
| X | X | - | - | - | - |
>
| - | X | X | - | - | - | - |
<=
| - | X | X | - | - | - | - |
>=
| - | X | X | - | - | - | - |
~
| - | - | X | X | X | X | X |
!~
| - | - | X | X | X | X | X |
in
| - | - | X | X | X | X | X |
not in
| - | - | X | X | X | X | X |
any in
| - | - | - | X | X | X | X |
none in
| - | - | - | X | X | X | X |
=~
| - | - | X | - | X | - | - |
!=~
| - | - | X | - | X | - | - |
~~
| - | - | X | - | X | - | - |
!~~
| - | - | X | - | X | - | - |
in~
| - | - | X | - | X | - | - |
not in~
| - | - | X | - | X | - | - |
any in~
| - | - | - | - | X | - | - |
none in~
| - | - | - | - | X | - | - |
|
Remember | Example |
---|
Operators ~, !~, in and not in can be used for checking a single element (number or text) against a number list or a text list | 1 in [1, 2, 3] ["blue", "red"] ~ "blue" .
| Operators ~, !~, in and not in when used with a text are useful to look for substrings in another string. | "I love coding" ~ "love" "I don't like Mondays" !~ "Fridays" "love" in "I love coding" "Fridays" not in "I don't like Mondays".
| Operators ~, !~, in and not in respect cardinality, i.e., container list must have at least the same number of elements as contained list. | [1, 1] in [1, 1, 1] [1, 1] not in [1, 2, 3] .
| Operators = and != , when used for comparing lists, require to have the same elements, with the same cardinality and the same order. | [1, 2, 3] = [1, 2, 3] [4, 5, 6] != [4, 6, 5] .
| Operators <, >, <= and >= work according to lexicographical order when comparing strings. |
|
|
|
Logical operatorsThe table below lists all logical operators that can be used for linking logical terms in an expression. Logical operators take logical terms (which return values) as operands and can thus be built using: - 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
Operator | Meaning | Precedence |
---|
NOT or ! | logical negation | 1 (highest) | AND or & | logical conjunction | 2 | OR or | | logical disjunction | 3 | XOR | exclusive or, i.e., a XOR b is equivalent to a AND !b OR !a AND b | 3 | IMPLIES or IMP | logical implication, i.e., a IMPLIES b is equivalent to !a OR b | 4 | XNOR or EQV | logical equivalence, i.e., a EQV b is equivalent to a IMPLIES b AND b IMPLIES a | 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 (IF - THEN -ELSE)The conditional operator ?
: is a powerful operator to construct conditional expressions. It basically allows you to construct the following expression: IF boolean_expression true THEN term_1 ELSE term_2. The format to be used is: <boolean_expression> ? <term_1> : <term_2> |
Expression | Description |
---|
%{issue.priority} = "Highest" ? "Please have a look at this issue immediately" : "No stress, come back later" |
| IF the priority of an issue is Blocker, THEN this function will return the "Please have a look at this issue immediately" ELSE it will return the "No stress, come back later". |
{issue.duedate} != null ? ({...duedate} - {...currentDateTime}) / {HOUR} : 0 |
| IF an issue does have a due date set (due date is not null), THEN this function will return the of hours from the current date-time to the due date ELSE it will return the 0 . |
%{issue.somefield} = "Red" ? "Color" : "No color" |
| IF a custom field (e.g. a select list) has a value of Red, THEN this function will return the text Color, ELSE it will return No color. |
timePart({...currentDateTime}, LOCAL) > 21:00 AND timePart({...currentDateTime}, LOCAL) < 7:00 ? "Night" : "Day" |
| IF the current time is between 21:00 and 7:00 THEN this function will return the "Night" , ELSE it will return the "Day". |
|
|