Excerpt | ||||
---|---|---|---|---|
| ||||
Take a deeper dive into functions, properties, and the Expr language. |
The following guides will walk you through working with Expr.
Child pages (Children Display) |
---|
Learn More
For more information about using functions and variables in formulas, see:
...
...
Expr (pronounced like "expert" without the "t") is Structure’s formula language. It can be used in Formula Columns to perform calculations or comparisons based on issue fields, as well as in Sort generators.
If you’ve ever created formulas in Excel or Google Sheets, some elements of Expr will look familiar. We tried to make it as similar to other spreadsheet formula languages as possible while still allowing for more complex features, such as working with arrays or Jira item properties.
Learn Expr
Expand | ||
---|---|---|
| ||
There are a few ways to add formulas to a structure:
The guides below will cover the main elements of formulas and how to use them. |
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Variables are used to represent values (numbers, text strings, arrays, etc.) within a formula and can represent:
Naming VariablesVariable names can contain:
Variables cannot contain spaces. The first character must be a letter or an underscore. Examples:
As you write your formula, Structure attempts to map your variables to well-known sources. For example, the "remaining_estimate" variable above will automatically be mapped to the Remaining Estimate field. If it can’t map the variable automatically, you will need to select a value for the variable.
Learn more: Mapping Variables, Predefined Variables Property AccessFormulas can also access the value of an item's property using the following notation:
For a complete list of supported properties, see Item Properties. Learn more: Expr Advanced Reference - Property Access
Local variables are similar to Variables, but they are defined locally within the formula, rather than being mapped to an attribute or Jira field. This can be helpful when an expression needs to be used more than once in the same formula. Instead of repeating the expression, you can turn it into a local variable, using
In this example, declaring a local variable “total_time” ensures that every instance of total_time is exactly the same, and if you ever need to change how total_time is calculated, you only have to change it once. Learn more: Expr Advanced Reference - Local Variables |
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
Functions are predefined expressions that can be used within a formula. Functions calculate a value based on their arguments.
Function CallsA function call is written as the function name, followed by parentheses, which may or may not contain arguments. Examples:
Function names are not case-sensitive: you can write There are 100+ standard functions available with Structure – see Standard Functions for a complete list.
Learn more: /wiki/spaces/DRAFTSTRUCTUREDC/pages/3669066050 Aggregate FunctionsAggregate functions calculate the total value from multiple rows within a structure. Unless otherwise specified, this includes the issue and all its sub-issues. Examples:
For a complete list of available Aggregate functions, see: Aggregate Functions To learn more about using Aggregate functions, see: Expr Advanced Reference - Aggregate Function Aggregate Function ModifiersAggregate Functions can also contain modifiers, which influence how the aggregation works. Modifiers always begin with the hash sign (
For a complete list of available Aggregate modifiers, see: Aggregate Functions To learn more about using Aggregate functions and their modifiers, see: Expr Advanced Reference - Aggregate Function Chained Function CallsIf you need to apply a sequence of functions to the same value, you can simplify this using the chained notation: listing each function one after the other, separated by a dot (
When you use the chain notation, the value that comes before the dot becomes the first argument for the next function. Any additional arguments must be written after the function, in parentheses. For example:
In this example, FORMAT_DATETIME takes the date value in "created" and formats it based on the argument in parenthesis ( User FunctionsA user function allows you to define a locally-used function within a formula. Local functions are declared using the following construct:
Example:
Learn more: Expr Advanced Reference - User Functions |
Expand | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
You can include arithmetic operations, comparisons, logical operations, and text operations within a formula.
Learn more: Expr Advanced Reference - Operators. Order of Operations When several types of operations are used, they are done in the following order:
|
Expand | ||||
---|---|---|---|---|
| ||||
Conditional expressions ( A simple "IF" expression can be declared using the IF() function, but for more elaborate IF cases, with multiple conditions and/or requiring an ELSE option, a conditional expression can be used:
Learn more: Expr Advanced Reference - Conditional Expressions |
Expand | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
The following number types are supported in Structure formulas:
The following elements are not supported:
Learn more: Expr Advanced Reference - Values and Types |
Expand | ||
---|---|---|
| ||
Text values should be enclosed in single quotes ( Examples:
If the text value itself contains quotes, do one of the following:
Example: The following both represent represent the text value Charlie "Bird" Parker:
Learn more: Expr Advanced Reference - Values and Types Text SnippetsText Snippets allow you to generate strings using variables and expressions. This is particularly helpful in formulas that utilize markdown. When using text snippets:
Learn more: Expr Advanced Reference - Values and Types |
Expand | ||
---|---|---|
| ||
Comments can be added to a formula to provide context or an explanation of what is being calculated, without affecting the formula itself.
|
Learn More
To learn more about the concepts discussed above, see: