Calculation syntax

Calculation syntax

This page describes the syntax to perform calculations using formulas.

You can also the new visual editor if you prefer!

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

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

Arithmetic operations

Syntax

Output

Description

Examples

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

Syntax

Output

Description

Examples

Syntax

Output

Description

Examples

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

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)

MAX(value1: number, value2: number)

number

Returns the maximum value between two numbers.

  • MAX(@Width, @Height)

  • MAX(0, @Priority)

  • POW(base: number, exponent: number)

  • POWER(base: number, exponent: number)

number

Returns a number raised to a power.

  • POW(2, 10)

  • POWER(@Width, 2)

 

Text functions

Syntax

Output

Description

Examples

Syntax

Output

Description

Examples

CONCAT(value1: string, value2: string, …)

string

Concatenates two or more values into a single string, with no separator added between them. Accepts string, number or boolean values, which are converted to text. Requires at least two arguments.

  • CONCAT(@Key, " - ", @Name)

  • CONCAT("REQ-", @Number)

LOWER(value: string)

string

Returns the lower-case value of a string.

  • LOWER(@Name)

  • LOWER("HELLO")

UPPER(value: string)

string

Returns the upper-case value of a string.

  • UPPER(@Key)

  • UPPER("hello")

CAPITALIZE(value: string)

string

Capitalizes the first letter of each word in a string and lower-cases the remaining letters.

  • CAPITALIZE(@Name)

  • CAPITALIZE("hello world")

TRIM(value: string)

string

Removes leading and trailing whitespace from a string.

  • TRIM(@Name)

  • TRIM(" hello ")

LTRIM(value: string)

string

Removes leading (left-side) whitespace from a string.

  • LTRIM(@Name)

  • LTRIM(" hello")

RTRIM(value: string)

string

Removes trailing (right-side) whitespace from a string.

  • RTRIM(@Key)

  • RTRIM("hello ")

REVERSE(value: string)

string

Returns the string with its characters in reverse order.

  • REVERSE(@Key)

  • REVERSE("hello")

Conditional functions

Syntax

Output

Description

Examples

Syntax

Output

Description

Examples

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

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.

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

  • 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.

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

  • SUMIF(ext@Estimate * @Cost, from@Refines, @Width * 2 >= 120)

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

number