Number
Numbers can be written as integers, or as decimals. The period character .
is the separator for decimal numbers.
Thousands separators, such as ,
are not supported.
5
5.3
5456.732
5,456.732 // NOT VALID
Numeric Operators
Operator |
Definition |
|
Add numbers |
|
Substract numbers |
|
Multiply numbers |
|
Divide numbers |
|
Returns modulo (remainder) of division between numbers |
Examples
5 + 5 // 10
10 * 10 // 100
myNumber := 50
myNumber := myNumber + 1
myNumber // 51
otherNumber := 2
myNumber - otherNumber // 49
Operator Precedence
()
Parentheses can be used to wrap expressions and calculate them first./
,%
,*
all have equal precedence. They are evaluated left to right.+
,-
have secondary precedence.
Examples
myNumber := 10
2 + myNumber / 2 // 7
(myNumber + 3) * 5 // 65
Special Values
NA
is a special value that represents Not Available. It means there is no number value for an expression.
A[100,BOP+100y,EOP+100Y] // NA because no data has been entered for the period 100 years in the future
A[100,BOP+100y,EOP+100Y] = NA // True
NaN
is a special value that represents Not a Number. It means there is no valid number for an expression.
numerator := 100
denominator := 0
numerator/denominator // NaN
numerator/denominator = NaN // True
Numeric Functions
abs
Returns the absolute value of the value.
Syntax |
Return Value |
|
The absolute value of |
- value
The number to take the absolute value of
Examples
abs(-13) // 13
myNumber := - 500
abs(-500) // 500
cbrt
Returns the cube root of the value.
Syntax |
Return Value |
|
The cube root of |
- value
The number to take the cube root of
Examples
cbrt(729) // 9
myNumber := 125
cbrt(myNumber) // 5
ceil
Returns the value rounded up to the nearest integer.
Syntax |
Return Value |
|
The next integer to |
- value
The number to take the ceiling of
Examples
ceil(13.3) // 14
ceil(0.5) // 1
myNumber := 4.7834
ceil(myNumber) // 5
floor
Returns the value rounded down to the nearest integer.
Syntax |
Return Value |
|
The previous integer to |
- value
The number to take the floor of
Examples
floor(13.3) // 13
floor(0.5) // 0
myNumber := 4.7834
floor(myNumber) // 4
round
Returns the value rounded to the nearest integer. Values such as 0.5 will be rounded up.
Syntax |
Return Value |
|
The nearest integer to |
- value
The number to round
Examples
round(13.3) // 13
round(0.5) // 1
myNumber := 4.7834
round(myNumber) // 5
sqrt
Returns the square root of the value.
Syntax |
Return Value |
|
The square root of |
- value
The number to take the square root of
Examples
sqrt(81) // 9
myNumber := 225
sqrt(myNumber) // 15
Traditional Functions
Traditional Functions written in the Function Calculator can also be used in Extended. When evaluated, these Functions will yield a numeric value.
Additionally, when writing these functions in Extended it is not necessary to wrap tokens within ${}
. If the traditional dollar sign + curly braces syntax
is present, the Function will still be evaluated without issues.
Examples
[100] // Calculates value of Node with ID 100, Node Type defaults to Actual
A[100] // Calculates value of Node with ID 100 for Node Type Actual
T[100] // Calculates value of Node with ID 100 for Node Type Actual
AGG('A[100]', *this) // Calculates value of Node with ID 100 for the current org + children
AGG('A[${this.object.nodeReference.id}]', ${this.object.orgRollup}) // Calculates the value of the node in the nodeReference property of
// of the object, for the organizations in the orgRollup property
AGG('A[this.object.nodeReference.id]', this.object.orgRollup) // No ${ } syntax used