Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
Excerpt
hiddentrue
nameCalculations syntax

Learn our syntax to perform calculations on your requirement’s data.

This page describes the syntax to perform calculations using formulas.

You can also the new visual editor if you prefer!

Info

Note: When writing calculation formulas, remember that they are evaluated on a per-requirement basis.

Info

Note: If a property name contains space characters, you can escape them using a backslash \.

Arithmetic operations

Syntax

Output

Description

Examples

number + number

number

Adds two numbers.

  • @Cost + ext@Taxes

  • @Width + 2.5

number - number

number

Subtracts a number from another.

  • ext@Budget - ext@Spent

  • 150 - @Height

number * number

number

Multiplies two numbers.

  • ext@Estimate * @Cost

  • 1.2 * @Cost

number / number

number

Divides a number by another.

  • @Width / @Height

  • @Cost / 0.75

number % number

number

Returns the remainder of the division between two numbers.

  • @Length % ext@Segment

  • ext@Man\ days % 10

...

Aggregation functions

MAX(value1: number, value2

Syntax

Output

Description

Examples

ABS(value: number)

number

Returns the absolute value of a number.

  • ABS(10.75)

  • ABS(ext@Cost)

CEIL(value: number)

number

Returns the nearest integer greater than or equal to a number.

  • CEIL(25.3)

  • CEIL(@Width)

FLOOR(value: number)

number

Returns the nearest integer less than or equal to a number.

  • FLOOR(3.1415)

  • FLOOR(1.3 * ext@Width)

ROUND(value: number)

number

Rounds a number to the nearest integer.

  • ROUND(10.5)

  • ROUND(ext@Budget)

SQRT(value: number)

number

Returns the square root of a number.

  • SQRT(25)

  • SQRT(@Width + @Height)

MIN(value1: number, value2: number)

number

Returns the minimum value between two numbers.

  • MIN(@Cost, ext@Budget)

  • MIN(@Priority, 5)

COUNT(requirements: requirement[])

number

Counts requirements in a given list.

  • COUNT(from@Refines)

  • COUNT(to@Refinesfrom@Uses)

SUM(expression: number, requirements: requirement[])

number

Computes the sum of a numeric expression evaluated on a given list of requirements.

  • SUM(@Cost, from@Refines)

  • SUM(ext@Estimate * @Cost, from@Refines)

  • SUM(1.2 * @Cost, from@Refinesfrom@Uses)

AVG(expression: number, requirements: requirement[])

number

Computes the average of a numeric expression evaluated on a given list of requirements.

  • AVG(@Cost, from@Refines)

  • AVG(ext@Estimate, from@Refinesfrom@Uses)

  • AVG(ext@Man\ days * 150, from@Refines)

MAX(expression: number, requirements: requirement[])

number

Computes the maximum of a numeric expression evaluated on a given list of requirements.

  • MAX(@Cost, from@Refines)

  • MAX(2.5 * ext@Estimate, from@Refines)

  • MAX(ext@Weight, from@Refinesfrom@Uses)

MIN(expression: number, requirements: requirement[])

number

Computes the minimum of a numeric expression evaluated on a given list of requirements.

  • MIN(@Cost, from@Refines)

  • MIN(ext@Budget + 200, from@Refines)

  • MIN(ext@Estimate, from@Refinesfrom@Uses)

Mathematical functions

Syntax

Output

Description

Examples

ABS(value: number)

number

Returns the

maximum value between two numbers

absolute value of a number.

  • MAX(@Width, @Height)

  • MAX(0, @Priority)

  • POW(base: number, exponent: number)

  • POWER(base: number, exponent
    • ABS(10.75)

    • ABS(ext@Cost)

    CEIL(value: number)

    number

    Returns the nearest integer greater than or equal to a number

    raised to a power

    .

    POW(2, 10
    • CEIL(25.3)

    POWER
    • CEIL(@Width

    , 2

    Syntax

    Output

    Description

    Examples

    COUNT(requirements: requirement[]
    • )

    Aggregation functions

    FLOOR(value: number)

    number

    Returns the nearest integer less than or equal to a number.

    • FLOOR(3.1415)

    • FLOOR(1.3 * ext@Width)

    ROUND(value: number)

    number

    Counts requirements in a given list

    Rounds a number to the nearest integer.

    COUNT
    • ROUND(

    from@Refines
    • 10.5)

    COUNT
    • ROUND(

    to@Refinesfrom@Uses
    • ext@Budget)

    SUM

    SQRT(

    expression

    value: number

    , requirements: requirement[]

    )

    number

    Computes

    Returns the

    sum

    square root of a

    numeric expression evaluated on a given list of requirements

    number.

    SUM
    • SQRT(

    @Cost, from@Refines
    • 25)

    SUM(ext@Estimate * @Cost, from@RefinesAVG(expression
    • SQRT(@Width + @Height)

  • SUM(1.2 * @Cost, from@Refinesfrom@Uses)

  • MIN(value1: number,

    requirements

    value2:

    requirement[]

    number)

    number

    Computes the average of a numeric expression evaluated on a given list of requirements.

    AVG

    Returns the minimum value between two numbers.

    • MIN(@Cost,

    from@Refines
    • ext@Budget)

    AVG
    • MIN(

    ext@Estimate, from@Refinesfrom@Uses) AVG(ext@Man\ days * 150, from@Refines
    • @Priority, 5)

    MAX(

    expression

    value1: number,

    requirements

    value2:

    requirement[]

    number)

    number

    Computes

    Returns the maximum

    of a numeric expression evaluated on a given list of requirements

    value between two numbers.

    • MAX(

    @Cost
    • @Width,

    from@Refines
    • @Height)

    • MAX(

    2.5 * ext@Estimate, from@Refines
    • 0, @Priority)

    MAX
    • POW(

    ext@Weight, from@Refinesfrom@Uses
    • base: number, exponent: number)

    MIN
    • POWER(

    expression
    • base: number,

    requirements
    • exponent:

    requirement[]
    • number)

    number

    Computes the minimum of a numeric expression evaluated on a given list of requirements.

    • MIN(@Cost, from@Refines)

    • MIN(ext@Budget + 200, from@Refines)

    • MIN(ext@Estimate, from@Refinesfrom@Uses)

    Returns a number raised to a power.

    • POW(2, 10)

    • POWER(@Width, 2)

    Conditional functions

    Syntax

    Output

    Description

    Examples

    IF(condition: boolean, success: T, failure: T)

    Info

    Where T can be one of the following: number, boolean or string

    T

    Returns one value if a condition is true and another if it is false.

    • IF(@Cost > ext@Budget, ext@Budget - @Cost, 0)

    • IF(key ~ ‘TN-%’, ext@Tested AND @Delivered, @Delivered)

    • IF(@Priority > 3, ‘High priority’, ‘Low priority’)

    COUNTIF(requirements: requirement[], condition: boolean)

    number

    Counts the number of requirements meeting a given condition.

    COUNT
    • COUNTIF(from@Refines, ext@Estimate + 10 >= 25)

    COUNT
    • COUNTIF(to@Refinesfrom@Uses, @Cost < 1500)

    SUMIF(expression: number, requirements: requirement[], condition: boolean)

    number

    Computes the sum of a numeric expression evaluated on requirements meeting a given condition.

    SUM
    • SUMIF(@Cost, from@Refines, key ~ ‘TECH-%’)

    SUM
    • SUMIF(ext@Estimate * @Cost, from@Refines

    ) SUM(1.2 * @Cost, from@Refinesfrom@Uses
    • , @Width * 2 >= 120)

    AVGIF(expression: number, requirements: requirement[], condition: boolean)

    number

    Computes the average of a numeric expression evaluated on requirements meeting a given condition.

    AVG
    • AVGIF(@Cost, from@Refines, @Priority = 1)

    AVG
    • AVGIF(ext@Estimate, from@Refinesfrom@Uses

    ) AVG(ext@Man\ days * 150, from@Refines
    • , ext@Approved AND ext@Delivered)

    MAXIF(expression: number, requirements: requirement[], condition: boolean)

    number

    Computes the maximum value of a numeric expression evaluated on requirements meeting a given condition.

    MAX
    • MAXIF(@Cost, from@Refines, @Author = ‘Jane’)

    MAX
    • MAXIF(2.5 * ext@Estimate, from@Refines

    ) MAX(ext@Weight, from@Refinesfrom@Uses
    • , 1.2 * @Cost > 500)

    MINIF(expression: number, requirements: requirement[], condition: boolean)

    number

    Computes the minimum value of a numeric expression evaluated on requirements meeting a given condition.

    MIN
    • MINIF(@Cost, from@Refines, NOT ext@Delivered)

    MIN
    • MINIF(ext@Budget + 200, from@Refines

    )MIN(ext@Estimate, from@Refinesfrom@Uses
    • , @Tested)

    PERCENT(requirements: requirement[], condition: boolean)

    number

    Computes the percentage of requirements meeting a given condition.

    • PERCENT(child, ext@Status = ‘approved’)

    • PERCENT(child@Refines->child, ext@Cost > 1000)

    Requirement expressions

    Syntax

    Output

    Description

    Examples

    relationship

    requirement[]

    Retrieves linked requirements (parent or child) for the current requirement.

    • from

    • to

    • from@Refines

    • to@Uses

    • relationship->relationship

    • relationship→relationship

    requirement[]

    Retrieves linked requirements (parent or child with multiple levels of depth) to the current requirement.

    • tofrom@Uses

    • from@Refinesfrom@Uses

    DISTINCT(requirements: requirement[])

    requirement[]

    Filters a requirement list to keep only distinct requirements.

    • DISTINCT(tofrom@Uses)

    • DISTINCT(from@Refinesfrom@Uses)

    FILTER(requirements: requirement[], condition: boolean)

    requirement[]

    Filters a requirement list to keep only requirements meeting a given condition.

    • FILTER(fromfrom@Uses, ext@Cost > 1000)

    • FILTER(from@Teststo@Extends, ext@Approved AND ext@Delivered)

    Boolean expressions

    Syntax

    Output

    Description

    Examples

    NOT boolean

    boolean

    Applies a logical NOT to a boolean expression.

    • NOT ext@Delivered

    • NOT (@Approved AND ext@Delivered)

    boolean AND boolean

    boolean

    Applies a logical AND between two boolean expressions.

    • @Tested AND true

    • false AND true

    boolean OR boolean

    boolean

    Applies a logical OR between two boolean expressions.

    • ext@Approved OR true

    • false OR true

    • expression = expression

    • expression == expression

    boolean

    Indicates whether two expressions are equal.

    • @Priority = 1

    • 1.2 * @Cost == 500

    • @Author = ‘John Doe’

    • expression != expression

    • expression <> expression

    boolean

    Indicates whether two expressions are different.

    • @Priority != 5

    • @Width * 2 <> 120

    number > number

    boolean

    Indicates whether a numeric expression is greater than another.

    • @Cost > 200

    • 1.2 * @Cost > ext@Budget

    number >= number

    boolean

    Indicates whether a numeric expression is greater or equal to another.

    • @Cost >= 100

    • ext@Estimate + 10 >= 25

    number < number

    boolean

    Indicates whether a numeric expression is less than another.

    • @Cost < 1500

    • ext@Man\ days < 30

    number <= number

    boolean

    Indicates whether a numeric expression is less or equal to another.

    • @Width > 6.5

    • ext@Estimate <= 20

    • string ~ string

    • string LIKE string

    • string ILIKE string

    boolean

    Indicates whether a string expression matches a string pattern.

    • text ~ ‘%important%’

    • @Author ~ ‘John%’

    expression IS NULL

    boolean

    Indicates whether an expression is null.

    • @Cost IS NULL

    • ext@Delivered IS NULL

    expression IS NOT NULL

    boolean

    Indicates whether an expression is not null.

    • @Priority IS NOT NULL

    • ext@Estimate IS NOT NULL