Versions Compared

Key

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


Page properties
hiddentrue


Tech review

Status
titletodo

Style guide

Status
titletodo

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



UI Text Box
sizemedium
typeinfo

This type of read-only custom field has a value which is dynamically calculated from a custom math/numeric expression. It can be used to obtain a numeric value depending on the value of other fields in current issue or in any other issues (linked issues, sub-tasks, epics, stories, JQL selected issues, etc).


Configuration

Math expression

Info
iconfalse

This parameter contains a valid math expression that will be calculated each time the value of the field is required.

Example 1 : Calculated Number Field "Number of Blocking Issues"

Info

In this step by step example we show how to create a calculated number field called "Number of Blocking Issues" that will return the number of unresolved issues, the current issue is linked to "is blocked by" issue link type.


UI Steps


UI Step

Create a new Calculated Number Field custom field called "Number of Blocking Issues"

Head over to Administration > Issues


> Custom fields > Add Custom Field > Advanced > fields → Add custom Field → Advanced → Calculated Number Field (by JWT)field (by JWT)



UI Step

On the configuration screen of the newly created custom field go to Actions and click on Configure


UI Step

Click on Edit Math/Time Expression


UI Step

Configure the field by entering a math/time expression. Learn more about JWT expression parser. After the configuration, click on Save



UI Text Box
typeinfo

The math expression used in this example is: count(filterByResolution(linkedIssues("is blocked by"), ""))



UI Step

Finally, the configuration of the new custom field should look like this:



Example 2: Calculated Number Field "Time to Due Date"

Info
iconfalse

In this example we configure a calculated number field that will show the remaining time for Due Date


Info

We use the following math-time expression: {00012} != null ? max({00012} - {00057}, 0) : null, where {00012}  is code for Due date, and {00057} is code for Current date and time.

To achieve this, the following functions are used:

  • Conditional operator ?: in order to avoid errors in the subtraction when Due date is not set. In this case we return null, i.e., not initialized.
  • max() is used to avoid returning a negative duration when the Due date has passed.

We select duration as display format, since the numeric value being calculated, a number of milliseconds, represents a time duration. This way the value is represented like Time to Due Date: 2d 9h 43m instead of a single number.

We also check parameter "Uninitialized when calculated value is zero", since we don't want the field to be shown once Due Date has been reached.