Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Page properties
hiddentrue


Status
Tech review

Status
colourGreen
title

todo

done

Style guide

Status
colourGreen
titledone

Page status

Status
colourGreen
title

todo

complete

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged



UI Text Box
sizemedium
typeinfo

The JWT expression parser accepts the most common comparison operatorsas  as well as logical operators

The main purpose of these operators is to construct complex logical comparisons by linking individual expressions. 


Excerpt

Comparison operators

The operators, their meaning and the applicable data types you can use them with are listed below.

UI Text Box
typetip

A comparison always returns a

Status
subtletrue
titleboolean
 value.


UI Expand
titleOverview of all case-sensitive comparison operators


UI Text Box
typeinfo

All operators respect the case of the characters.


OperatorMeaningExamples (all examples return true)
= equal to


Code Block
languagebash
linenumberstrue
1=1
true = true
[1, 2, 3] = [1, 2, 3]
["blue", "red", "green"] = ["blue", "red", "green"]


UI Text Box
typeinfo

When working with Lists, each elements' existence and its order are being evaluated.


!= not equal to


Code Block
languagebash
linenumberstrue
0 != 1
"HELLO" != "Hello"
%{issue.description} != "Hello"
true != false
[1, 2, 3] != [1, 3, 2]
["blue", "red", "green"] != ["blue", "green", "red"]


UI Text Box
typeinfo

When working with Lists, each elements' existence and its order are being evaluated.


< less than


Code Block
languagebash
linenumberstrue
1 < 2
"abc" < "bbc"
"abc" < "abcd"


> greater than


Code Block
languagebash
linenumberstrue
2 > 1
"bbc" > "abc"
"abcd" > "abc"


<= less than or equal to


Code Block
languagebash
linenumberstrue
3 <= 3


>= greater than or equal to


Code Block
languagebash
linenumberstrue
"Hello world! Hello *" >= "Hello world"


~ contains


Code Block
languagebash
linenumberstrue
"Hello world!" ~ "world" 
#checks whether a string contains a substring
#true. The text "world" is contained in the first text.
%{issue.components.leads} ~ %{system.currentUser} #checks whether "Component leads" contains the "Current user".

[1, 2, 3, 2, 2, 4] ~ [2, 1, 2] 
#number 2 occurs twice and number 1 once. [
#true
["blue", "red", "green", "red", "white", "red"] ~ ["red", "green", "red"] 
#number 2 occurs twice and number 1 once. (
#true
["green", "red"] ~ ["red", "green", "red"]
)
 
= false
#false


!~ does not contain


Code Block
languagebash
linenumberstrue
"Hello world!" !~ "
Hello
world
!" %{issue.fixVersions} !~
" #false. The text "world" is contained in the first text.
%{issue.fixVersions} !~ %{issue.versions}
, checks whether "Fix
 #false if all "Affects version/s"
doesn't contain all versions in "Affects
 are also selected as "Fix 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.
 #true
["blue", "red", "green", "red", "red"] !~ ["red", "green", "green", "red"] #true


in is contained in


Code Block
languagebash
linenumberstrue
"world" in "Hello world!
" , to check whether a substring is contained in a string.
" #true. The text "world" is contained in the first text.
%{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. 
 #true if current user is a component lead of any of the issue's components 
[1, 1, 2] in [2, 1, 1, 1, 4] #true
["blue", "red", "red"] in ["red", "green", "blue", "red", "red"]
,  cardinalities of every single instance of an element must match. 
2 in
 #true
2 in [1, 2, 3]

 #true
"blue" in ["red, "blue", "white"] #true


not in is not contained in


Code Block
languagebash
linenumberstrue
"Hello world!" not in "world"

 #true
%{issue.versions} not in %{issue.fixVersions}
, checks whether not all versions in
 #false if all "Affects version/s"
are contained in
 are also selected as "Fix version/s".


[1, 1, 2, 2] not in [2, 1, 1, 1, 4]
, cardinalities of every single element must match. 
 #true
["blue", "red", "red", "blue"] not in ["red", "blue", "red", "red"]
, cardinalities of every single instance of an element must match. 
5 not in
 #true 
5 not in [1, 2, 3, 3, 4]

 #true
"orange" not in ["blue", "red", "white"] #true


any in
some
any element is in


Code Block
languagebash
linenumberstrue
%{issue.versions} any in %{issue.fixVersions}
, checks whether any version in
 # true if any selected "Affects version/s"
is contained in "Fix
 has also been selected as "Fix version/s".

 
[1, 3] any in [3, 4, 5]

 #true
["blue", "white"] any in ["black", "white", "green"] #true


none in no single element is in


Code Block
languagebash
linenumberstrue
%{issue.versions} none in %{issue.fixVersions}
, checks whether there isn't a single version "Affects
 #true if no selected "Affects version/s"
in "Fix
 has also been selected as "Fix version/s".

 
[1, 2] none in [3, 4, 5]

 #true
["blue", "red"] none in ["black", "white", "green"] #true



UI Text Box
typetip

When comparing lists, the exact number of occurence (cardinality) per element must match. 

Parser expressionOutputDescription


Code Block
languagebash
linenumberstrue
[
1
"blue", 
2
"red", 
3
"green", 
2
"red", 
2
"white", 
4
"red"] ~ [
2
"red", 
1
"green", 
2
"red"]


true This expression returns true , since the element (
number
text)
2
red appears at least twice in the first list and the element (
number
text)
1 occurs
green occurs at least
once
once in the first list.


Code Block
languagebash
linenumberstrue
[
1, 2, 3, 2, 2, 4
"green", "red"] ~ [
1
"red", 
1
"green", 
2
"red"]


false This expression returns false , since the element (
number
text)
1
red does not appear twice in the first list. 




UI Expand
titleOverview of all case ignoring comparison operators


UI Text Box
typeinfo

The following comparison operators are applicable to  can be used with   

Status
subtletrue
titlestringtext
 and 
Status
subtletrue
titlestring text list
   data types .

All operators ignore the case of the characters.


OperatorMeaningExamples (all examples return true)
=~ equal to

Code Block
languagebash
linenumberstrue
"HELLO" =~ "Hello"

 #true
"up" =~ "UP"

 #true
["blue", "red", "green"] =~ ["Blue", "RED", "Green"] #true


!=~ not equal to

Code Block
languagebash
linenumberstrue
" HELLO" !=~ "Hello"

"up" !=~ "down"
 #false, since there is a whitespace in the first text
"up" !=~ "down" #true
("up" !=~ "UP")
= false
 #false 
["blue", "red"] !=~ ["Blue", "green"]

 #true
["blue", "red"] !=~ ["Red", "BLUE"]

(
 #true
["blue", "red", "green"] !=~ ["Blue", "RED", "Green"]
) = false
 #false


~~ contains

Code Block
languagebash
linenumberstrue
"Hello 
"Hello
World!" ~~ "world" #true, checks whether a
string
 text contains a substring.

 
"A small step for a man" ~~ "STEP"
, checks whether a string contains a substring.
 #true
["one", "two", "three"] ~~ ["TWO", "One"] #true, checks whether a
string
 text list contains all the elements of another
string
 text list.


!~~ does not contain

Code Block
languagebash
linenumberstrue
"Hello World!" !~~ "bye" #true, 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.
 a text does not contain a substring. 
"A small step for a man" !~~ "big" #true
["one", "two", "three"] !~~ ["Four"] #true, checks whether a
string list doesn't contain one element of another string list.
 text list does not contain a single element of another text list. 
(["one", "two", "three"] !~~ ["TWO"]) = false


in~ is contained in

Code Block
languagebash
linenumberstrue
"world" in~ "Hello World!" #true, checks whether a substring is contained in another
string
 text.

 
"STEP" in~ "A small step for a man"
, checks whether a substring is contained in another string.
 #true 
["TWO", "One"] in~ ["one", "two", "three"] #true, checks whether all the elements of a
string
 text list are contained in another
string
 text list.


not in~ is not contained in

Code Block
languagebash
linenumberstrue
"bye" not in~ "Hello World!" #true, checks whether a substring is not contained in another
string
 text.

 
"big" not in~ "A small step for a man"
, checks whether a substring is not contained in another string.
 #true
["Four"] not in~ ["one", "two", "three"] #true, checks whether any of the elements of a
string
 text list are not contained in another
string
 text list.

(
 
["TWO"] not in~ ["one", "two", "three"]
) = false
 #false


any in~
some
any element is in

Code Block
languagebash
linenumberstrue
["blue", "violet"] any in~ ["Blue", "Red", "Green"]

 #true
["Five", "One"] any in~ ["FOUR", "FIVE", "SIX"]"bye" #true


none in~ no single element is in

Code Block
languagebash
linenumberstrue
["Orange"]
any
 none in~ ["red", "blue", "green"]

(["orange"] any in~
 #true, checks whether none of the elements of a text list are not contained in another text list. 
["orange"] none in~ ["Red", "Orange"]
) = false
 #false




info
UI Expand
titleApplicable data types

Below you find a comprehensive matrix of all operators and applicable data types .

Comparison Operator

Status
subtletrue
titleBOOLEAN

Status
subtletrue
titlenumber

Status
subtletrue
titleText

Status
subtletrue
titlenumber list

Status
subtletrue
titletext list

Status
subtletrue
titleissue list

status
=
subtle
(tick)
true
= (tick)(tick)XXXXX
(tick)
titleMULTI-value field
(tick)(tick)(tick)(tick)
!=
X
(tick)
X
(tick)
X
(tick)
X
(tick)
XX
(tick)
X
(tick)
<
X
-
X
(tick)
-
(tick)---
> -
X
(tick)
X
(tick)---
-
<= -
X
(tick)
X
(tick)---
-
>= -
X
(tick)
X-
(tick)---
~ --
X
(tick)
X
(tick)
XX
(tick)
X
(tick)
!~ --
X
(tick)
X
(tick)
X
(tick)
X
(tick)
X
in --
X
(tick)
X
(tick)
XX
(tick)
X
(tick)
not in --
X
(tick)
X
(tick)
X
(tick)
X
(tick)
X
any in ---
X
(tick)
XX
(tick)
X
(tick)
none in ---
X
(tick)
X
(tick)
X
(tick)
X
=~ --
X
(tick)-
X
(tick)-
-
!=~ --
X
(tick)-
X-
(tick)-
~~ --
X
(tick)-
X
(tick)-
-
!~~ --
X
(tick)-
X
(tick)-
-
in~ --
X-
(tick)-
X
(tick)-
not in~ --
X
(tick)-
X
(tick)-
-
any in~ ----
X
(tick)-
-
none in~ ----
X
(tick)-


ui-text-
Infobox
titleThings to be aware of
typeinfo

Please be aware the both operators operands of the respective comparison must have the same data type. The only exceptions are the following:

  • Automatic casting from Number to Stringfrom 
    Status
    subtletrue
    titlenumber
    to
    Status
    subtletrue
    titletext
    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 string text term, the parser will automatically transform the right-hand side term into a string text (e.g. "30" = 30 will be interpreted the same way as "30" = "30")
  • Single values as operator operand in list operations: Operators ~, !~, in  and not in can be used for checking a single element (number or string) against a 
    Status
    subtletrue
    titlenumber
    list
     or a  or
    Status
    subtletrue
    titletext
    list
    )
    against a 
    Status
    subtletrue
    titlenumber list
     or a 
    Status
    subtletrue
    titletext list
  • Comparison with the null value: A field which is not set or an empty string text is interpreted as null. A field returning 
    Status
    subtletrue
    titlenumber
     field, which doesn't contain a number, is also interpreted as null .



UI Expand
titleThings to remember


Note
Remember
Example
Examples

Operators ~, !~, in  and not in can

be

be used for checking a single element (

Status
subtletrue
titlenumber
or
Status
subtletrue
titletext
)
against a 

number list or a text list

Status
subtletrue
titlenumber list
 or a 
Status
subtletrue
titletext list


Code Block
languagebash
linenumberstrue
1 in [1, 2, 3] 
  • 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.


    Code Block
    languagebash
    linenumberstrue
    "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.


    Code Block
    languagebash
    linenumberstrue
    [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.


    Code Block
    languagebash
    linenumberstrue
    [1, 2, 3] = [1, 2, 3]
    
    [4, 5, 6] != [4, 6, 5]
    .


    Operators <, >, <= and >= work according to lexicographical order when comparing

    strings

    text.

    Image RemovedLogical operators


    Code Block
    languagebash
    linenumberstrue
    1 < 2
    "abc" < "bbc"
    "abcd" > "abc"



    Image AddedLogical 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 

    Status
    subtletrue
    titleboolean
     values) as operands and can thus be built using:

    • a boolean value
    • 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.
    ui-text-expandbox
    typenote

    Logical operators can only be used in logical expressions in the Logical mode or in combination with the conditional operator.


    UI Expand
    titleOverview of all logical operators
    titleOverview of all logical operators


    Operator

    Meaning

    Operator

    Meaning

    Precedence

    NOT or  ! logical negation1 (highest)
    AND  or  & logical conjunction2
    OR or  | logical disjunction3
    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)


    UI Text Box
    typeinfo

    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 )


    Image ModifiedConditional 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 logical_expression  true THEN  term_1   ELSE  term_2.

    Code Block
    linenumberstrue
    <boolean<logical_expression> ? <term_1> : <term_2> 

    Image Added

    UI Text Box
    typetip

    The conditional operator is extremely helpful when being used in calculated fields.


    UI Expand
    titleExamples of using the conditional operator


    ExpressionDescription


    Code Block
    linenumberstrue
    %{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 
    Status
    subtletrue
    titletext

     "Please have a look at this issue immediately"

    ELSE it will return

    the  Statussubtletruetitletext "

     "No stress, come back later".


    Code Block
    linenumberstrue
    {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 
    Status
    subtletrue
    titlenumber
    of

    the number of hours from the current date-time to the due date 

    ELSE it will

    return the 
    Status
    subtletrue
    titlenumber

    return  0 .


    Code Block
    linenumberstrue
    %{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 

    return "No color".


    Code Block
    linenumberstrue
    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  Statussubtletruetitletext 

    return "Night" ,

    ELSE it will

    return the  Statussubtletruetitletext "Day".

    return "Day".





    Image AddedList operators

    Page properties report
    firstcolumnFunction
    headingsShort description, Output
    cqllabel = "list_managment_operator" and space = currentSpace()

    UI Expand
    titleOrder of operations

    If you use multiple operators in a single expression, they will follow a certain order in which they are processed or a precedence.

    OPERATORSPRECEDENCEASSOCIATIVITY
    INTERSECT1 (highest)Left-to-right
    APPENDEXCEPTUNION2 (lowest)Left-to-right



    UI Text Box
    typetip
    • When using the list operators, you have to make sure that both lists that you compare are of the same type.
    • All operators are case insensitive, i.e., they can also be written in lower case: append, union, intersect and except .
    • There are four equivalent functions available for each type of list, and their behavior is exactly equivalent to that of its corresponding operator.
    • This way, you can choose to use operators or functions according to your preference. Although operators yield shorter expressions and with fewer parentheses, the usage of functions produces a more functional consistent syntax.



    Excerpt Include
    DECADIS:Contact support
    DECADIS:Contact support
    nopaneltrue