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

Panel

On this page

Table of Contents
exclude(On this page|Parser expression|Display format).*
stylecircle
typeflat
separatorpipe

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 the 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
iconfalse

Image AddedConfiguration

Configuring a calculated number field is straightforward. You have to configure a valid parser expression, which will "calculate" the output, and optionally a custom display format

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 Date-Time Field Number Field (by JWT) custom field and name it properly.

UI Text Box
typetip

Providing a description will help you to identify what the custom field does but this step is optional.

UI Step
Parser

Math/Numeric expression

Add the following expression:

Code Block
languagebash
titleMath expression for Calculated number field:
linenumberstrue
count(filterByResolution(linkedIssues("is blocked by"), ""))
Expand
titlemore info...
UI Text Box
typeinfo

To achieve this, the following functions are used:

UI Step

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

Image Removed

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.

a valid parser expression which will "calculate" the output.

Usually field codes will be used for this purpose.

UI Steps

Create a new Calculated Date-Time Field custom field and name it properly.

UI Step
UI Text Box
typetip

Providing a description will help you to identify what the custom field does but this step is optional

UI Step

Parser expression

Add the following expression:

Code Block
languagebash
titleMath expression for Calculated number field:Expression
linenumberstrue
%{00012issue.links.count} !=#This nullexample ? max({00012} - {00057}, 0) : null simply returns the number of linked issues. 

{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 ?:
  • max() is used to avoid returning a negative duration when the Due date has passed.

    Expand
    titlemore info...
    UI Text Box
    typetip

    The result of the calculation must be a valid number. 

    info
    UI Step

    Display format

    UI Steps
    UI Step

    Choose Duration for Content type

    UI Step

    Choose Short for Duration display format

    Expand
    titlemore info...
    UI Text Box
    typeinfo

    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.

    UI Step

    Check the parameter Uninitialized when calculated value is zero

    Expand
    titlemore info...
    UI Text Box
    typeinfo

    Since we don't want the field to be shown once Due Date has been reached.

    UI Step

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

    Image Removed

    Example 3: Field to show time since issue creation resolution

    Info
    iconfalse

    In this example we configure a calculated number field for showing the time elapsed since issue creation to issue resolution. For issues which are still not resolved, the field will be uninitialized, thus it won't be shown in the view screen.

    UI Steps UI Step

    Optionally choose a custom display format format. This is extremely useful to enhance usability for end users.

    Read more about the available Display formats.


    Image AddedUse cases and examples

    Page properties report
    headingsField type, JWT feature, Label
    sortByTitle
    cqllabel = "calculated-field" and space = currentSpace() and ancestor = currentContent()


    Excerpt Include
    DECADIS:Contact support
    DECADIS:Contact support
    nopaneltrue

    Page properties
    hiddentrue
    Tech review

    Status
    colourGreen
    titledone

    Style guide

    Status
    colourGreen
    titledone

    Page status

    Status
    colourGreen
    titlecomplete

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

    Create a new Calculated Date-Time Field custom field and name it properly.

    UI Text Box
    typetip

    Providing a description will help you to identify what the custom field does but this step is optional

    UI Step

    Parser expression

    Add the following parser expression:

    Code Block
    languagebash
    titleMath expression for Calculated number field:
    linenumberstrue
    {00112} != null ? {00112} - {00009} : null
    Expand
    titlemore info...
    UI Text Box
    typeinfo

    {00112} is code for Date and time of resolution, and {00009} is code for Date and time of creation.

    To achieve this the following functions are used:

    • Conditional operator ?:
    UI Step

    Display format

    UI Steps
    UI Step

    Choose Duration for Content type

    UI Step

    Choose Long for Duration display format

    UI Step

    Check the parameter Use time tracking settings

    Expand
    titlemore info...
    UI Text Box
    typeinfo

    We get the duration displayed using the number of working hours per day, and the number of working days per week as configured in time tracking, instead of 24 hours per day and 7 days per week.

    UI Step

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

    Image Removed
    Excerpt IncludeDECADIS:Contact supportDECADIS:Contact supportnopaneltrue