This article is for Data Center. Visit Cloud
Expr Advanced Reference - Introduction
In its simplest form, Expr language is built to be similar to Excel or Google Sheets formulas. Similarity to spreadsheet formulas, when possible, was a design goal, particularly when performing arithmetic operations, using functions, and referencing values from the spreadsheet (Jira fields or results of other formulas). The language becomes more complex once you need to work with arrays or items with properties.
 Expr is a declarative, dynamically typed language with elements of functional programming.
A few properties of the language are:
Expr is case-insensitive. Two identifiers different only in the upper or lower case will mean the same thing.
Whitespace, including new lines, is not meaningful. It is only required to separate word operators and identifiers; in all other cases there can be an arbitrary number of whitespace symbols.
Except in Text literals, the language supports only English (ASCII) letters, numbers and some punctuation symbols.
Aggressive type conversion: when a function requires a certain type and the value passed is of a different type, Expr will make the best effort to convert the passed value to the required type.
 Expressions and Values
A program written in Expr language is an expression. An expression is evaluated by Structure and produces a value. In a Formula column, the expression is calculated for each row by applying the expression to the issue or another item in that row, and the result is displayed in the corresponding Formula column cell.
Expr language is composable. If you have a valid expression, you can include it as a part of some other expression and it will be valid. Sometimes that will require wrapping it with parentheses.
Lazy Calculation
Expr expressions are calculated in a lazy manner (excluding aggregate functions and embedded queries). This means that, for example, only one branch in an IF expression is going to be calculated.
Displaying Calculation Result in a Formula Column
The Formula Column is the primary means of authoring and using formulas. It currently can display simple values, items, and flat arrays. (See Values and Types below.) If the formula returns a more complex construct – nested arrays or key-value maps, the current version of the column will not be able to display it. However, it doesn't mean the formula is not getting calculated!
Comments
At any place where a formula allows whitespace, you can use comments. Comments can span multiples lines or just one.
Multi-line comments start with "
/*"
 and end withÂ"*/"
 and can span multiple lines. Multi-lined comments cannot be nested.Single-line comments start with "
//"
 and continue through the end of the line.
Identifiers
All named elements of Expr – variables, local variables, functions and others – must have a valid identifier as their name.
An identifier consists of letters (Latin alphabet only: a-z, A-Z), digits (0-9) or underscore (_
) characters. The first character must be a letter or an underscore. An identifier must not be a keyword.
Versions 1.x of Expr also allowed the period character (.
) to be a part of the identifier. This possibility has been removed in Expr 2.0.
Keywords
The following keywords must not be used as identifiers.
AND, CONCAT, ELSE, IF, NOT, OR, UNDEFINED, WITH
Expr Language Versions
Expr Version | Structure Version | Major Improvements |
---|---|---|
Expr 1.0 | Structure 4.0 | Original version introduced |
Expr 1.5 | Structure 4.2 | Local variables, aggregate functions, comments |
Expr 2.0 | Structure 7.0 | Arrays, Items and Properties, User Functions, Chained Function Calls, Embedded Queries, Conditional Expression, Text Snippets, Concatenation Operator |
Â
Â