Pro Calc Library
Account calculations contain the core business logic in a financial model. These account calculations use calculation definition formulas. The Pro Calc Library provides the functions used in these calculation definitions.
Account calculations are used in budgeting, planning, and forecasting applications, where the goal is often to use existing data to generate new data based on a set of assumptions. Calculations also frequently involve manipulating large data sets across several dimensions.
Administrators use Model Manager to attach calculations to members of the Account dimension, and for the most part involve interactions among its members.
Below, the functions of the Pro Calc Library are grouped based on their use. In most groups the functions are listed in alpha order, unless another one is more logical.
Convertors
Functions that convert an input value to a specific data type.
toBoolean
Converts an Object to a Boolean value.
-
Null returns false.
-
Boolean values are cast and returned directly.
-
String values that are "true" (case insensitive) return true, all other strings return false.
-
Numbers return true if non-zero, false if zero.
-
All other object types return false.
Signature
toBoolean(obj Object)
Parameters
obj Object - the object to convert to a Boolean
Returns
the Boolean value of the object
Boolean
Example
toBoolean("true")
toDate
Cast value to LocalDate. If value cannot be cast then it will return null.
Valid Types
-
LocalDate
-
String: LocalDate
Signature
toDate(value Object)
Parameters
value Object - the value to be cast
Returns
LocalDate or null
LocalDate
Example
toDate("2025-12-10")
toDateTime
Cast valueto LocalDateTime.
If value cannot be cast then function returns null.
Valid Types:
-
LocalDateTime
-
String: LocalDateTime
Signature
toDateTime(value Object)
Parameters
value Object - the value to be cast
Returns
LocalDateTime or null
LocalDateTime
Example
toDateTime("2025-12-03T10:15:30")
toDouble
Cast value to Double. If value cannot be cast then it will return null.
Valid Types:
- Double
- Integer
- String: Double or Integer
Signature
toDouble(value Object)
Parameters
value Object - the value to be cast.
Returns
Double or null
Double
Example
toDouble(10)
toInt
Cast value to Integer. If value cannot be cast then it will return null.
Valid types:
-
Integer
-
String: Integer
Signature
toInt(value Object)
Parameters
value Object - the value to be cast
Returns
Integer or null
Integer
Example
toInt(10)
toString
Cast value to String.
If value is null then it will return null.
Signature
toString(value Object)
Parameters
value Object - the value to be cast
Returns
String or null
String
Example
toString(10)
Dates
Functions for date calculations.
now
Obtains the current UTC date.
This will query the system clock to obtain the current date. Specifying the time-zone avoids dependence on the default time-zone.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
Signature
now()
Parameters
n/a
Returns
the current date using UTC timezone
LocalDate
Example
now()
differenceInDays
Calculates the number of days between two LocalDate instances.
Signature
differenceInDays(startDate LocalDate, endDate LocalDate)
Parameters
- startDate LocalDate - The start date.
- endDate LocalDate - The end date.
Returns
The number of days between the start and end dates.
LONG
Example
differenceInDays(@[h/ Client]:[p/ Project Start Date], @[h/ Client]:[p/ Project End Date])
differenceInWeeks
Calculates the number of weeks between two LocalDate instances.
Signature
differenceInWeeks(startDate LocalDate, endDate LocalDate)
Parameters
- startDate LocalDate - The start date.
- endDate LocalDate - The end date.
Returns
The number of weeks between the start and end dates.
LONG
Example
differenceInWeeks(@[h/ Client]:[p/ Project Start Date], @[h/ Client]:[p/ Project End Date])
differenceInMonths
Calculates the number of months between two LocalDate instances.
Signature
differenceInMonths(startDate LocalDate, endDate LocalDate)
Parameters
- startDate LocalDate - The start date.
- endDate LocalDate - The end date.
Returns
The number of months between the start and end dates.
LONG
Example
differenceInMonths(@[h/ Client]:[p/ Project Start Date], @[h/ Client]:[p/ Project End Date])
differenceInQuarters
Calculates the number of quarters between two LocalDate instances.
A quarter is defined as a period of three months.
Signature
differenceInQuarters(startDate LocalDate, endDate LocalDate)
Parameters
- startDate LocalDate - The start date.
- endDate LocalDate - The end date.
Returns
The number of quarters between the start and end dates.
LONG
Example
differenceInQuarters(@[h/ Client]:[p/ Project Start Date], @[h/ Client]:[p/ Project End Date])
differenceInYears
Calculates the number of years between two LocalDate instances.
Signature
differenceInYears(startDate LocalDate, endDate LocalDate)
Parameters
- startDate LocalDate - The start date.
- endDate LocalDate - The end date.
Returns
The number of years between the start and end dates.
LONG
Example
differenceInYears(@[h/ Client]:[p/ Project Start Date], @[h/ Client]:[p/ Project End Date])
Helpers
Functions that assist with calculations.
|
|
infinityAsNull
Returns null if the given value is infinity value.
Signature
infinityAsNull(value Double)
Parameters
value Double - The value to check.
Returns
null if value is infinity, value otherwise.
Double
Example
infinityAsNull(10.0)
isNull
Checks if the given object is null.
Signature
isNull(value Object)
Parameters
value Object - The object to check.
Returns
true if the object is null; false otherwise.
BOOLEAN
Example
isNull(10.0)
isNullValue
Checks if the given value is null or near-zero value.
Signature
isNullValue(value Double)
Parameters
value Double - The value to check.
Returns
true if the value is null or near-zero value; false otherwise.
BOOLEAN
Example
isNullValue(10.0)
nullifyIfPossible
Attempts to nullify the given Double value if it's NaN, infinite, or below a certain threshold.
Signature
nullifyIfPossible(value Double)
Parameters
value Double - The input value.
Returns
Null if the value meets nullification criteria, otherwise the original value.
Double
Example
nullifyIfPossible(10.0)
nullValue
Generates a random double value close to zero, intended to represent a "null" value in scenarios where an actual null cannot be used.
Use with caution, as this introduces variability into your application.
Signature
nullValue()
Parameters
None.
Returns
A random double value between Double.MIN_VALUE and 1e-322.
Double
Example
nullValue()
resolveNaN
Converts NaN values to null, leaving other values unchanged.
Signature
resolveNaN(value Double)
Parameters
value Double - The input value.
Returns
Null if the value is NaN, otherwise the original value.
Double
Example
resolveNaN(10.0)
safeValue
Returns a safe value by either treating null as zero or by attempting to nullify the value based on certain conditions.
Signature
safeValue(value Double, treatNullAsZero BOOLEAN)
Parameters
value Double - The input value.
treatNullAsZero BOOLEAN - If true, treat null values as zero.
Returns
The original value, zero if null and treatNullAsZero is true, or null based on nullification logic.
Double
Example
safeValue(10.0, true)
safeValue(10.0, false)
Math
|
|
abs
Returns the absolute value of a double value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is positive zero or negative zero, the result is positive zero.
- If the argument is infinite, the result is positive infinity.
- If the argument is NaN, the result is NaN.
Signature
abs(value Double)
Parameters
value Double - the argument whose absolute value is to be determined
Returns
The absolute value of the argument.
Double
Example
abs(2.0)
acos
Returns the arc cosine of a value; the returned angle is in the range 0.0 through ,pi.
Special case:
- If the argument is NULL then the result is NULL.
- If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
- If the argument is 1.0, the result is positive zero.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
acos(value Double)
Parameters
value Double - the value whose arc cosine is to be returned.
Returns
The arc cosine of the argument.
Double
Example
acos(2.0)
asin
Returns the arc sine of a value; the returned angle is in the range pi/2 through pi/2.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
asin(value Double)
Parameters
value Double - the value whose arc sine is to be returned.
Returns
The arc sine of the argument.
Double
Example
asin(2.0)
atan
Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- If the argument is infinite, then the result is the closest value to pi/2 with the same sign as the input.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
atan(value Double)
Parameters
value Double - the value whose arc tangent is to be returned.
Returns
The arc tangent of the argument.
Double
Example
atan(2.0)
atan2
Returns the angle theta from the conversion of rectangular coordinates (,x,,, y) to polar coordinates (r theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi.
Special cases:
- If either argument is NULL, then the result is NULL.
- If either argument is NaN, then the result is NaN.
- If the first argument is positive zero and the second argument is positive, or the first argument is positive and finite and the second argument is positive infinity, then the result is positive zero.
- If the first argument is negative zero and the second argument is positive, or the first argument is negative and finite and the second argument is positive infinity, then the result is negative zero.
- If the first argument is positive zero and the second argument is negative, or the first argument is positive and finite and the second argument is negative infinity, then the result is the double value closest to pi.
- If the first argument is negative zero and the second argument is negative, or the first argument is negative and finite and the second argument is negative infinity, then the result is the double value closest to -pi.
- If the first argument is positive and the second argument is positive zero or negative zero, or the first argument is positive infinity and the second argument is finite, then the result is the double value closest to pi/2.
- If the first argument is negative and the second argument is positive zero or negative zero, or the first argument is negative infinity and the second argument is finite, then the result is the double value closest to -pi/2.
- If both arguments are positive infinity, then the result is the double value closest to pi/4.
- If the first argument is positive infinity and the second argument is negative infinity, then the result is the double value closest to 3*pi/4.
- If the first argument is negative infinity and the second argument is positive infinity, then the result is the double value closest to -pi/4.
- If both arguments are negative infinity, then the result is the double value closest to -3*pi/4.
The computed result must be within 2 ulps of the exact result. Results must be semi-monotonic.
Signature
atan2(y Double, x Double)
Parameters
- y Double - the ordinate coordinate
- x Double - the abscissa coordinate
Returns
The theta component of the point (,rtheta) in polar coordinates that corresponds to the point (x,,, y) in Cartesian coordinates.
Double
Example
atan(2.0)
cbrt
Returns the cube root of a double value. For positive finite xcbrt(-x) == -cbrt(x); that is, the cube root of a negative value is the negative of the cube root of that value's magnitude.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is an infinity with the same sign as the argument.
- If the argument is zero, then the result is a zero with the same sign as the argument.
The computed result must be within 1 ulp of the exact result.
Signature
cbrt(value Double)
Parameters
value Double - a value.
Returns
The cube root of value.
Double
Example
cbrt(2.0)
ceil
Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
- If the argument value is less than zero but greater than -1.0, then the result is negative zero.
Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x).
Signature
ceil(value Double)
Parameters
value Double - a value.
Returns
The smallest (closest to negative infinity) floating-point value that is greater than or equal to the argument and is equal to a mathematical integer.
Double
Example
ceil(2.0)
copySign
Returns the first floating-point argument with the sign of the second floating-point argument. If either argument is Null then the result is Null.
Note that unlike the copySign(double, double) method, this method does not require NaN sign arguments to be treated as positive values; implementations are permitted to treat some NaN arguments as positive and other NaN arguments as negative to allow greater performance.
Signature
copySign(magnitude Double, sign Double)
Parameters
- magnitude Double - the parameter providing the magnitude of the result
- sign Double - the parameter providing the sign of the result
Returns
A value with the magnitude of magnitude and the sign of sign.
Double
Example
copySign(2.0, 2.0)
cos
Returns the trigonometric cosine of an angle.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN or an infinity, then the result is NaN.
- If the argument is zero, then the result is 1.0.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
cos(value Double)
Parameters
value Double - an angle, in radians.
Returns
The cosine of the argument.
Double
Example
cos(2.0)
cosh
Returns the hyperbolic cosine of a double value. The hyperbolic cosine of x is defined to be (ex+e-x)/2 where e is E Euler's number.
Special cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is positive infinity.
- If the argument is zero, then the result is 1.0.
The computed result must be within 2.5 ulps of the exact result.
Signature
cosh(value Double)
Parameters
value Double - The number whose hyperbolic cosine is to be returned.
Returns
The hyperbolic cosine of value.
Double
Example
cosh(2.0)
exp
Returns Euler's number e raised to the power of a double value.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN, the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is negative infinity, then the result is positive zero.
- If the argument is zero, then the result is 1.0.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
exp(value Double)
Parameters
value Double - the exponent to raise e to.
Returns
The value e value where e is the base of the natural logarithms.
Double
Example
exp(2.0)
expm1
Returns ex -1.
Note that for values of x near 0, the exact sum of expm1(value) +1 is much closer to the true result of ex than exp(value).
Special cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is negative infinity, then the result is -1.0.
- If the argument is zero, then the result is a zero with the same sign as the argument.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
The result of expm1 for any finite input must be greater than or equal to -1.0.
Note that once the exact result of evalue-1 is within 1/2 ulp of the limit value -1 -1.0 should be returned.
Signature
expm1(value Double)
Parameters
value Double - the exponent to raise e to in the computation of evalue-1.
Returns
the value ,e value} -1.
Double
Example
expm1(2.0)
floor
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
Signature
floor(value Double)
Parameters
value Double - a value.
Returns
The largest (closest to positive infinity) floating-point value that less than or equal to the argument and is equal to a mathematical integer.
Double
Example
floor(2.0)
fma
Returns the fused multiply add of the three arguments; that is, returns the exact product of the first two arguments summed with the third argument and then rounded once to the nearest double.
The rounding is done using the round to nearest even rounding mode.
In contrast, if a * b + c is evaluated as a regular floating-point expression, two rounding errors are involved, the first for the multiply operation, the second for the addition operation.
Special cases:
- If any argument is Null, the result is Null.
- If any argument is NaN, the result is NaN.
- If one of the first two arguments is infinite and the other is zero, the result is NaN.
- If the exact product of the first two arguments is infinite (in other words, at least one of the arguments is infinite and the other is neither zero nor NaN) and the third argument is an infinity of the opposite sign, the result is NaN.
Note that fma(a, 1.0, c) returns the same result as (a + c). However, fma(a, b, +0.0) does not always return the same result as (a * b) since fma(-0.0, +0.0, +0.0) is +0.0, while (-0.0 * +0.0) is -0.0; fma(a, b, -0.0) is equivalent to (a * b) however.
Signature
fma(a Double , b Double , c Double)
Parameters
- a Double - a value
- b Double - a value
- c Double - a value
Returns
( a + b + c ) computed, as if with unlimited range and precision, and rounded once to the nearest double value
Double
Example
fma(2.0, 2.0, 2.0)
getExponent
Returns the unbiased exponent used in the representation of a double.
Special cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN or infinite, then the result is Double.MAX_EXPONENT + 1.
- If the argument is zero or subnormal, then the result is Double.MIN_EXPONENT} - 1.
Signature
getExponent(value Double)
Parameters
value Double - a double value
Returns
The unbiased exponent of the argument
Double
Example
getExponent(2.0)
hypot
Returns sqrt(x2 + y2) without intermediate overflow or underflow.
Special cases:
- If either argument is Null then the result is Null.
- If either argument is infinite, then the result is positive infinity.
- If either argument is NaN and neither argument is infinite, then the result is NaN.
- If both arguments are zero, the result is positive zero.
The computed result must be within 1 ulp of the exact result. If one parameter is held constant, the results must be semi-monotonic in the other parameter.
Signature
hypot(x Double, y Double)
Parameters
- x Double - a value
- y Double - a value
Returns
sqrt( x2 + y2) without intermediate overflow or underflow
Double
Example
hypot(2.0, 2.0)
log
Returns the natural logarithm (basee) of a double value.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN or less than zero, then the result is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is positive zero or negative zero, then the result is negative infinity.
- If the argument is 1.0 then the result is positive zero.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
log(value Double)
Parameters
value Double - a value
Returns
the value ln value the natural logarithm of value.
Double
Example
log(2.0)
log10
Returns the base 10 logarithm of a double value.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN or less than zero, then the result is NaN.
- If the argument is positive infinity, then the result is positive infinity. ,
- If the argument is positive zero or negative zero, then the result is negative infinity.
- If the argument is equal to 10n for integer n then the result is n. In particular, if the argument is 1.0 (100) then the result is positive zero.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
log10(value Double)
Parameters
value Double - a value
Returns
The base 10 logarithm of value.
Double
Example
log10(2.0)
log1p
Returns the natural logarithm of the sum of the argument and 1.
Note that for small values value the result of log1p(value) is much closer to the true result of ln(1 value) than the floating-point evaluation of log(1.0+value).
Special cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN or less than -1, then the result is 1 expm1(2.0) NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is negative one, then the result is negative infinity.
- If the argument is zero, then the result is a zero with the same sign as the argument.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
log1p(value Double)
Parameters
value Double - a value
Returns
the value ln(value+1), the natural log of value+1
Double
Example
log1p(2.0)
max
Returns the greater of two double values. That is, the result is the argument closer to positive infinity.
Special cases:
- If the arguments have the same value, the result is that same value.
- If either value is Null, then the result is Null.
- If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.
- If one argument is positive zero and the other negative zero, the result is positive zero.
Signature
max(a Double, b Double)
Parameters
- a Double - an argument.
- b Double - another argument.
Returns
The larger of a and b.
Double
Example
max(2.0, 2.0)
min
Returns the smaller of two double values. That is, the result is the value closer to negative infinity.
Special cases:
- If the arguments have the same value, the result is that same value.
- If either value is Null, then the result is Null.
- If either value is NaN, then the result is NaN. Unlike the numerical comparison operators, this method considers negative zero to be strictly smaller than positive zero.
- If one argument is positive zero and the other is negative zero, the result is negative zero.
Signature
min(a Double, b Double)
Parameters
- a Double - an argument.
- b Double - another argument.
Returns
The smaller of a and b.
Double
Example
min(2.0, 2.0)
nextAfter
Returns the floating-point number adjacent to the first argument in the direction of the second argument. If both arguments compare as equal the second argument is returned.
Special cases:
- If the argument is Null, then the result is Null.
- If either argument is a NaN, then NaN is returned.
- If both arguments are signed zeros, direction is returned unchanged (as implied by the requirement of returning the second argument if the arguments compare as equal).
- If start is ±Double.MIN_VALUE and direction, has a value such that the result should have a smaller magnitude, then a zero with the same sign as start is returned.
- If start is infinite and direction, has a value such that the result should have a smaller magnitude, Double.MAX_VALUE with the same sign as start is returned.
- If start is equal to ±Double.MAX_VALUE, and direction has a value such that the result should have a larger magnitude, an infinity with same sign as start is returned.
Signature
nextAfter(start Double, direction Double)
Parameters
- start Double - starting floating-point value
- direction Double - value indicating which of start's neighbors or start should be returned
Returns
The floating-point number adjacent to start in the direction of direction.
Double
Example
nextAfter(2.0, 2.0)
nextDown
Returns the floating-point value adjacent to value in the direction of negative infinity.
This method is semantically equivalent to nextAfter(value, Double.NEGATIVE_INFINITY); however, a nextDown implementation may run faster than its equivalent nextAfter call.
Special Cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, the result is NaN.
- If the argument is negative infinity, the result is negative infinity.
- If the argument is zero, the result is -Double.MIN_VALUE.
Signature
nextDown(value Double)
Parameters
value Double - starting floating-point value
Returns
The adjacent floating-point value closer to negative infinity.
Double
Example
nextDown(2.0)
nextUp
Returns the floating-point value adjacent to value in the direction of positive infinity.
This method is semantically equivalent to nextAfter(value, Double.POSITIVE_INFINITY); however, a nextUp implementation may run faster than its equivalent nextAfter call.
Special Cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, the result is NaN.
- If the argument is positive infinity, the result is positive infinity.
- If the argument is zero, the result is Double.MIN_VALUE.
Signature
nextUp(value Double)
Parameters
value Double - starting floating-point value
Returns
The adjacent floating-point value closer to positive infinity.
Double
Example
nextUp(2.0)
pow
Returns the value of the first argument raised to the power of the second argument.
Special cases:
- If either argument is NULL, then the result is NULL.
- If the second argument is positive or negative zero, then the result is 1.0.
- If the second argument is 1.0, then the result is the same as the 1 atan2(2.0, 2.0) first argument.
- If the second argument is NaN, then the result is NaN.
- If the first argument is NaN and the second argument is nonzero, then the result is NaN.
- if
- the absolute value of the first argument is greater than 1 and the second argument is positive infinity, or
- the absolute value of the first argument is less than 1 and the second argument is negative infinity,
then the result is positive infinity.
- if
- the absolute value of the first argument is greater than 1 and the second argument is negative infinity, or
- the absolute value of the first argument is less than 1 and the second argument is positive infinity,
then the result is positive zero.
- If the absolute value of the first argument equals 1 and the second argument is infinite, then the result is NaN.
- if
- the first argument is negative zero and the second argument is a positive finite odd integer, or
- the first argument is negative infinity and the second argument is a negative finite odd integer,
then the result is negative zero.
- if
- the first argument is negative zero and the second argument is less than zero but not a finite odd integer, or
- the first argument is negative infinity and the second argument is greater than zero but not a finite odd integer,
then the result is positive infinity.
- if
- the first argument is negative zero and the second argument is a negative finite odd integer, or
- the first argument is negative infinity and the second argument is a positive finite odd integer,
then the result is negative infinity.
- if the first argument is finite and less than zero
- if the second argument is a finite even integer, the result is equal to the result of raising the absolute value of the first argument to the power of the second argument
- if the second argument is a finite odd integer, the result is equal to the negative of the result of raising the absolute value of the first argument to the power of the second argument
- if the second argument is finite and not an integer, then the result is NaN
- If both arguments are integers, then the result is exactly equal to the mathematical result of raising the first argument to the power of the second argument if that result can in fact be represented exactly as a double value.
(In the foregoing descriptions, a floating-point value is considered to be an integer if and only if it is finite and a fixed point of the method ceil, or, equivalently, a fixed point of the method floor. A value is a fixed point of a one-argument method if and only if the result of applying the method to the value is equal to the value.)
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
pow(a Double, b Double)
Parameters
a Double - the base.
b Double - the exponent.
Returns
The value ab.
Double
Example
pow(2.0, 2.0)
random
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range.
Signature
random()
Parameters
n/a
Returns
null
Double
Example
random()
rint
Returns the double value that is closest in value to the argument and is equal to a mathematical integer. If two double values that are mathematical integers are equally close, the result is the integer value that is even.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
Signature
rint(value Double)
Parameters
value Double - a double value.
Returns
The closest floating-point value to value that is equal to a mathematical integer.
Double
Example
rint(2.0)
round
Returns the closest long to the argument, with ties rounding to positive infinity.
Special cases:
- If the argument is Null, the result is Null.
- If the argument is NaN, the result is NaN.
- If the argument is infinity the result is infinity.
Signature
round(value Double)
Parameters
value Double - a floating-point value to be rounded.
Returns
the value of the argument rounded to the nearest double value.
Double
Example
round(2.0)
scalb
Returns value×,2scaleFactor rounded as if performed by a single correctly rounded floating-point multiply.
If the exponent of the result is between Double.MIN_EXPONENT and Double.MAX_EXPONENT, the answer is calculated exactly.
If the exponent of the result would be larger thanDouble.MAX_EXPONENT an infinity is returned.
Note that if the result is subnormal, precision may be lost; that is, when scalb(x, n) is subnormal, scalb(scalb(x, n) -n) may not equal, x. When the result is non-NaN, the result has the same sign as value.
Special cases:
- If the first argument is Null, Null is returned.
- If the first argument is NaN, NaN is returned.
- If the first argument is infinite, then an infinity of the same sign is returned.
- If the first argument is zero, then a zero of the same sign is returned.
Signature
scalb(value Double, scaleFactor INT)
Parameters
- value Double - number to be scaled by a power of two.
- scaleFactor INT - power of 2 used to scale d
Returns
value × 2scaleFactor
Double
Example
scalb(2.0, 2)
signum
Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero.
Special Cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, then the result is NaN.
- If the argument is positive zero or negative zero, then the result is the same as the argument.
Signature
signum(d Double)
Parameters
d Double - the floating-point value whose signum is to be returned.
Returns
The signum function of the argument
Double
Example
signum(2.0)
sin
Returns the trigonometric sine of an angle.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN or an infinity, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
The computed result must be within 1 ulp of the exact result.
Results must be semi-monotonic.
Signature
sin(value Double)
Parameters
value Double - an angle, in radians.
Returns
The sine of the argument.
Double
Example
sin(2.0)
sinh
Returns the hyperbolic sine of a double value. The hyperbolic sine of x is defined to be (ex-e-x)/2 where e is Euler's number.
Special cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, then the result is NaN.
- If the argument is infinite, then the result is an infinity with the same sign as the argument.
- If the argument is zero, then the result is a zero with the same sign as the argument.
The computed result must be within 2.5 ulps of the exact result.
Signature
sinh(value Double)
Parameters
value Double - The number whose hyperbolic sine is to be returned.
Returns
The hyperbolic sine of value.
Double
Example
sinh(2.0)
sqrt
Returns the correctly rounded positive square root of a double value.
Special cases:
- If the argument is NULL, then the result is NULL.
- If the argument is NaN or less than zero, then the result 1 log10(2.0) is NaN.
- If the argument is positive infinity, then the result is positive infinity.
- If the argument is positive zero or negative zero, then the result is the same as the argument.
Otherwise, the result is the double value closest to the true mathematical square root of the argument value.
Signature
sqrt(value Double)
Parameters
value Double - a value.
Returns
The positive square root of value. If the argument is NaN or less than zero, the result is NaN.
Double
Example
sqrt(2.0)
tan
Returns the trigonometric tangent of an angle.
Special cases:
- If the argument is NULL then the result is NULL.
- If the argument is NaN or an infinity, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Signature
tan(value Double)
Parameters
value Double - an angle, in radians.
Returns
The tangent of the argument.
Double
Example
tan(2.0)
tanh
Returns the hyperbolic tangent of a double value. The hyperbolic tangent of x is defined to be (ex-e-x)/(ex+e-x,), in other words, sinh(x)/cosh(x).
Note that the absolute value of the exact tanh is always less than 1.
Special cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
- If the argument is positive infinity, then the result is +1.0.
- If the argument is negative infinity, then the result is -1.0.
The computed result must be within 2.5 ulps of the exact result. The result of tanh for any finite input must have an absolute value less than or equal to 1.
Note that once the exact result of tanh is within 1/2 of an ulp of the limit value of ±1, correctly signed ± 1.0 should be returned.
Signature
tanh(value Double)
Parameters
value Double - The number whose hyperbolic tangent is to be returned.
Returns
The hyperbolic tangent of value.
Double
Example
tanh(2.0)
toDegrees
Converts an angle measured in radians to an approximately equivalent angle measured in degrees. The conversion from 1 atan(2.0) 1 toRadians(2.0) radians to degrees is generally inexact; users should not expect cos(toRadians(90.0)) to exactly equal 0.0.
Special cases:
- If the argument is NULL then the result is NULL.
Signature
toDegrees(value Double)
Parameters
value Double - an angle, in radians
Returns
The measurement of the angle value in degrees.
Double
Example
toDegrees(2.0)
toRadians
Converts an angle measured in degrees to an approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact.
Special cases:
- If the argument is NULL then the result is NULL.
Signature
toRadians(value Double)
Parameters
value Double - an angle, in degrees
Returns
The measurement of the angle value in radians.
Double
Example
toRadians(2.0)
ulp
Returns the size of an ulp of the argument. An ulp, unit in the last place, of a double value is the positive distance between this floating-point value and thedouble value next larger in magnitude.
Note that for non-NaN x ulp(-x) == ulp(x).
Special Cases:
- If the argument is Null, then the result is Null.
- If the argument is NaN, then the result is NaN.
- If the argument is positive or negative infinity, then the result is positive infinity.
- If the argument is positive or negative zero, then the result is Double.MIN_VALUE.
- If the argument is ± Double.MAX_VALUE, then the result is equal to 2971.
Signature
ulp(d Double)
Parameters
d Double - the floating-point value whose ulp is to be returned.
Returns
The size of an ulp of the argument
Double
Example
ulp(2.0)
Member properties
Functions for retrieving member properties.
|
|
getPropertyAsBoolean
Member property value is converted to Boolean after it is retrieved.
Signature
getPropertyAsBoolean(location ILocation optional, hierarchyName String, property String)
Parameters
- location ILocation optional - null
- hierarchyName String - null
- property String - null
Returns
Boolean
Boolean
Example
getPropertyAsBoolean([m/ 100], [h/ Account], [p/ PropertyName])
getPropertyAsBoolean([h/ Account], [p/ PropertyName])
getPropertyAsDate
Member property value is converted to LocalDate after it is retrieved.
Signature
getPropertyAsDate(location ILocation optional, hierarchyName String, property String)
Parameters
- location ILocation optional - null
- hierarchyName String - null
- property String - null
Returns
LocalDate
LocalDate
Example
getPropertyAsDate([m/ 100], [h/ Account], [p/ PropertyName])
getPropertyAsDate([h/ Account], [p/ PropertyName])
getPropertyAsDateTime
Member property value is converted to LocalDateTime, after it is retrieved.
Signature
getPropertyAsDateTime(location ILocation optional, hierarchyName String, property String)
Parameters
- location ILocation optional - null
- hierarchyName String - null
- property String - null
Returns
LocalDateTime
LocalDateTime
Example
getPropertyAsDateTime([m/ 100], [h/ Account], [p/ PropertyName])
getPropertyAsDateTime([h/ Account], [p/ PropertyName])
getPropertyAsDouble
Member property value is converted to Double after it is retrieved.
Signature
getPropertyAsDouble(location ILocation optional, hierarchyName String, property String)
Parameters
- location ILocation optional - null
- hierarchyName String - null
- property String - null
Returns
Double
Double
Example
getPropertyAsDouble([m/ 100], [h/ Account], [p/ PropertyName])
getPropertyAsDouble([h/ Account], [p/ PropertyName])
getPropertyAsInt
Member property value is converted to Integer after it is retrieved.
Signature
getPropertyAsInt(location ILocation optional, hierarchyName String, property String)
Parameters
- location ILocation optional - null
- hierarchyName String - null
- property String - null
Returns
Integer
Integer
Example
getPropertyAsInt([m/ 100], [h/ Account], [p/ PropertyName])
getPropertyAsInt([h/ Account], [p/ PropertyName])
getPropertyAsString
Member property value is converted to String after it is retrieved.
Signature
getPropertyAsString(location ILocation optional, hierarchyName String, property String)
Parameters
- location ILocation optional - null
- hierarchyName String - null
- property String - null
Returns
String String
Example
getPropertyAsString([m/ 100], [h/ Account], [p/ PropertyName])
getPropertyAsString([h/ Account], [p/ PropertyName])
property
Retrieves the member property value for a specified hierarchy member in current location.
Signature
property(location ILocation optional, hierarchyName String, property String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location that belongs to the property provided
- property String - the name of the property you want to retrieve
Returns
Object (LocalDate, String, Integer, Double)
Object
Example
property([m/ 100], [h/ Account], [p/ PropertyName])
property([h/ Account], [p/ PropertyName])
Member traversal
|
combineLocations
Combines both passed location lists into one list.
Signature
combineLocations(a ILocation[], b ILocation[])
Parameters
- a ILocation[] - location
- b ILocation[] - location
Returns
Array of locations
ILocation[]
Example
combineLocations(getLeafDescendants([h/ Client]), getLeafDescendants([h/ Currency]))
crossJoin
Returns a list of locations from multiple list of locations by cross-join unique location from each hierarchy.
Signature
crossJoin(originalLocation ILocation optional, locations ILocation[])
Parameters
- originalLocation ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- locations ILocation[] - list of locations to create cross product
Returns
locations
ILocation[]
Example
crossJoin(list([h/ Client]:[m/ 100], [h/ Currency]:[m/ CAD]))
crossJoin(getLocation([m/ 3200]), list([h/ Client]:[m/ 100], [h/ Currency]:[m/ CAD]))
isLeaf
Checks if the current location is at a leaf level on the specified hierarchy.
Signature
isLeaf(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
boolean
BOOLEAN
Example
isLeaf([h/ Client])
getAncestor
Obtains the locations of an ancestor member, which is at a given distance from the current member, for the hierarchy that is provided as an argument.
Signature
getAncestor(location ILocation optional, hierarchyName String, distance INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution.
- hierarchyName String - hierarchy name for member referenced in the location
- distance INT - distance from the current member
Returns
The location of an ancestor member.
ILocation
Example
getAncestor([m/ 100], [h/ Account], 2)
getAncestor([h/ Account], 2)
getAncestorKey
The key value of an ancestor member, which is at a given distance from the current member, for the hierarchy that is provided as an argument.
Signature
getAncestorKey(location ILocation optional, hierarchyName String, distance INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
- distance INT - distance from the current member
Returns
The key value of an ancestor member.
String
Example
getAncestorKey([m/ 100], [h/ Account], 2)
getAncestorKey([h/ Account], 2)
getChildren
Obtains a collection of locations of child members of the current member.
Signature
getChildren(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Collection of locations of child members.
ILocation[]
Example
getChildren([m/ 100], [h/ Account])
getChildren([h/ Account])
getChildrenKeys
Obtains a collection of keys of child members of the current member.
Signature
getChildrenKeys(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Collection of keys of child members.
String[]
Example
getChildrenKeys([m/ 100], [h/ Account])
getChildrenKeys([h/ Account])
getClosingMember
Find the last location of the time member that shares a common ancestor of the current member. The common ancestor is selected by the given level number.
Signature
getClosingMember(location ILocation optional, levelNumber INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - the level where the common ancestor is searched for
Returns
location
ILocation
Example
getClosingMember([m/ Q1], 2)
getClosingMember(2)
getClosingMemberKey
Find the last member of the time member that shares a common ancestor of the current member. The common ancestor is selected by the given level number.
Signature
getClosingMemberKey(location ILocation optional, levelNumber INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - the level where the common ancestor is searched for
Returns
member key String
Example
getClosingMemberKey([m/ Q1], 2)
getClosingMemberKey(2)
getFirstChild
Obtains a location that is at the first position among the child members of the current member.
Signature
getFirstChild(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Location of the first child.
ILocation
Example
getFirstChild([m/ 100], [h/ Account])
getFirstChild([h/ Account])
getFirstChildKey
Obtains a member that is at the first position among the child members of the current member.
Signature
getFirstChildKey(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Member of the first child.
String
Example
getFirstChildKey([m/ 100], [h/ Account])
getFirstChildKey([h/ Account])
getFirstSibling
Obtains a location that is at the first position among the sibling members, where they are sharing the common parent.
Signature
getFirstSibling(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Location of the first sibling.
ILocation
Example
getFirstSibling([m/ 100], [h/ Account])
getFirstSibling([h/ Account])
getFirstSiblingKey
Obtains a member that is at the first position among the sibling members, where they are sharing the common parent.
Signature
getFirstSiblingKey(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Member key of the first sibling.
String
Example
getFirstSiblingKey([m/ 100], [h/ Account])
getFirstSiblingKey([h/ Account])
getLag
Returns a location that is located in the Time dimension with a position specified by a user.
Signature
getLag(location ILocation optional, offset INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- offset INT - number of time members to traverse to the past
Returns
location
ILocation
Example
getLag([m/ Q1], 10)
getLastChild
Obtains a location that is at the last position among the child members of the current member.
Signature
getLastChild(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Location of the last child.
ILocation
Example
getLastChild([m/ 100], [h/ Account])
getLastChild([h/ Account])
getLastChildKey
Obtains a member that is at the last position among the child members of the current member.
Signature
getLastChildKey(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Location of the last child.
String
Example
getLastChildKey([m/ 100], [h/ Account])
getLastChildKey([h/ Account])
getLastPeriods
Takes the current location and returns number of previous time members up to a specified number, including the current time member. If it cannot find a member, for example, Time dimension has no more members to return due to the start date has reached, the function may return less than the specified count.
Signature
getLastPeriods(location ILocation optional, count INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- count INT - number of members to return
Returns
A collection of locations
ILocation[]
Example
getLastPeriods([m/ Q1], 2)
getLastPeriods(2)
getLastSibling
Obtains a location that is at the last position among the sibling members, where they are sharing the common parent.
Signature
getLastSibling(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
A location of the last sibling members.
ILocation
Example
getLastSibling([m/ 100], [h/ Account])
getLastSibling([h/ Account])
getLastSiblingKey
Obtains a member that is at the last position among the sibling members, where they are sharing the common parent.
Signature
getLastSiblingKey(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
A member of the last sibling members.
String
Example
getLastSiblingKey([m/ 100], [h/ Account])
getLastSiblingKey([h/ Account])
getLead
Returns a location that is located in the time dimension with a position specified by a user.
Signature
getLead(location ILocation optional, offset INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- offset INT - number of time members to traverse to the future
Returns
location
ILocation
Example
getLead([m/ Q1], 10)
getLeafDescendants
Obtains a collection of locations of leaf level members of the current member.
Signature
getLeafDescendants(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
Collection of leaf level locations.
ILocation[]
Example
getLeafDescendants([m/ 100], [h/ Account])
getLeafDescendants([h/ Account])
getLeafDescendantKeys
Obtains a collection of keys of leaf level members of the current member.
Signature
getLeafDescendantKeys(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution hierarchyName String - hierarchy name for member referenced in the location
Returns
Collection of leaf level member keys.
String[]
Example
getLeafDescendantKeys([m/ 100], [h/ Account])
getLeafDescendantKeys([h/ Account])
getLocation
Create a new location by applying the passed unique name on the current location.
Signature
getLocation(location ILocation optional, uniqueName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- uniqueName String - unique name
Returns
location
ILocation
Example
getLocation
Create a new location by applying the passed unique names on the current location.
Signature
getLocation(location ILocation optional, uniqueNames String[])
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- uniqueNames String[] - unique names
Returns
Location
ILocation
Example
getLocation([m/ 3200])
getLocation([h/ Resource]:[m/ 3200])
getLocation(list([h/ Version]:[m/ ACT], [h/ Account]:[m/ 10]))
getOpeningMember
Find the first location of the time member that shares a common ancestor of the current member. The common ancestor is selected by the given level number.
Signature
getOpeningMember(location ILocation optional, levelNumber INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - the level where the common ancestor is searched for.
Returns
location
ILocation
Example
getOpeningMember([m/ Q1], 2)
getOpeningMember(2)
getOpeningMemberKey
Find the first member of the time member that shares a common ancestor of the current member. The common ancestor is selected by the given level number.
Signature
getOpeningMemberKey(location ILocation optional, levelNumber INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - the level where the common ancestor is searched for
Returns
Member key
String
Example
getOpeningMemberKey([m/ Q1], 2)
getOpeningMemberKey(2)
getParallelMember
Find a descendant location of the time that has the same relative position as the current member from a different ancestor. The target ancestor is selected by the offset value from the current member\u2019s ancestors on a level given by the user.
Signature
getParallelMember(location ILocation optional, levelNumber INT, offset INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - the level where the common ancestor is searched for
- offset INT - offset from the current ancestor. Negative numbers will move the position backward
Returns
location
ILocation
Example
getParallelMember([m/ Q1], 2, 1)
getParallelMember(2, 1)
getParallelMemberKey
Find a descendant member of the time that has the same relative position as the current member from a different ancestor. The target ancestor is selected by the offset value from the current member\u2019s ancestors on a level given by the user.
Signature
getParallelMemberKey(location ILocation optional, levelNumber INT, offset INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - the level where the common ancestor is searched for
- offset INT - offset from the current ancestor; negative numbers will move the position backward
Returns
member key
String
Example
getParallelMemberKey([m/ Q1], 2, 1)
getParallelMemberKey(2, 1)
getParent
Obtains the location of the parent member for the hierarchy that is provided as an argument.
Signature
getParent(location ILocation optional, hierarchyName String)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
The location of the parent member.
ILocation
Example
getParent([m/ Q1], [h/ Time])
getParent([h/ Time])
getParentKey
The key value of the parent member for the hierarchy that is provided as an argument.
Signature
getParentKey(location ILocation optional, hierarchyName String )
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- hierarchyName String - hierarchy name for member referenced in the location
Returns
The key value of the parent member.
String
Example
getParentKey([m/ Q1], [h/ Time])
getParentKey([h/ Time])
getTimeAncestor
Obtains the location of time ancestor member at the specified level from current time member.
Signature
getTimeAncestor(location ILocation optional, levelNumber INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - level index of time hierarchy
Returns
The location of an ancestor member.
ILocation
Example
getTimeAncestor([m/ Q1], [h/ Time], 2)
getTimeAncestor([h/ Time], 2)
getTimeAncestorKey
Obtains the member key of time ancestor member at the specified level from current time member.
Signature
getTimeAncestorKey(location ILocation optional, levelNumber INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- levelNumber INT - level index of time hierarchy
Returns
The location of an ancestor member.
Example
getTimeAncestorKey([m/ Q1], [h/ Time], 2)
getTimeAncestorKey([h/ Time], 2)
Operators
|
in
Checks whether a specified value is present in the given set of values.
Signature
in(value T, values T[])
Parameters
- value T - The value to check for.
- values T[] - A varargs array of values to check against.
Returns
True if the value is present in the values array; false otherwise.
BOOLEAN
Example
in("PS_01", list("PS_02", "PS_01", "PS_03"))
between
Checks whether a value is between two other values (inclusive).
Signature
between(value T, start T, end T)
Parameters
- value T - The value to check.
- start T - The start of the range.
- end T - The end of the range.
Returns
True if the value is between start and end (inclusive); false otherwise.
BOOLEAN
Example
between(5.0, 2.0, 10.0)
between(@[h/ Time]:[p/ StartPeriod], @[h/ Client]:[p/ Project Start Date], @[h/ Client]:[p/ Project End Date])
Point resolvers
avg
Special operation used for a list of locations. This is a shortcut to resolving each location, sum them up, and then calculate the average.
Signature
avg(locations ILocation[], ignoreEmpty BOOLEAN optional)
Parameters
- locations ILocation[] - represents the tuple locations of all the hierarchies in the model that is intended for this execution
- ignoreEmpty BOOLEAN optional - indicates how to treat the null values
Returns
value
Double
Example
avg(list([m/ 100], [h/ Resource]:[m/ 3200]), true)
avg(list([m/ 100], [h/ Resource]:[m/ 3200]), false)
avg(list([m/ 100], [h/ Resource]:[m/ 3200]))
input
Gets the value from the context.
Signature
input(location ILocation optional)
Parameters
location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
Returns
Double
Double
Example
input([m/ 100])
input()
lag
The previous (in the Time dimension) value of the current member.
Signature
lag(location ILocation optional, offset INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- offset INT - distance from the current time member
Returns
value
Double
Example
lag([m/ 100], 1)
lag(1)
lagReset
Returns the previous (in the Time dimension) value of the current member but will reset at the beginning of the year. This means when we get to the beginning of year, the value returned will be 0d.
Signature
lagReset(location ILocation optional, offset INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- offset INT -
Returns
Double
Double
Example
lagReset([m/ BASE], 12)
lagReset(12)
lead
The next (in the Time dimension) value of the current member.
Signature
lead(location ILocation optional, offset INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- offset INT - distance from the current time member
Returns
value
Double
Example
lead([m/ 100], 1)
lead(1)
rollingNPeriod
Calculates values of a time-perspective dimension for leaf and non-leaf cells respecting account\u2019s Time calculation method specified by a user.
Note: This function is only available in a Time-Perspective dimension.
Signature
rollingNPeriod(location ILocation optional, count INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution
- count INT - Number of previous leaf time members values for the specified member to retrieve for the rolling calculation; the number is inclusive of the current member
Returns
value or null, calculated value based on the Account's Time conversion method
Double
Example
rollingNPeriod([m/ BASE], 12)
rollingNPeriod(12)
rollingPeriod
The sum of all the period values for starting at the location specified.
Signature
rollingPeriod(location ILocation optional, count INT)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the modelthat is intended for this execution.
- count INT - number of previous time members values for the specified member to retrieve
Returns
value
Double
Example
rollingPeriod([m/ 100], 1)
rollingPeriod(1)
select
Signature
select(location ILocation optional, treatNullAsZero BOOLEAN optional)
Parameters
- location ILocation optional - represents the tuple location of all the hierarchies in the model that is intended for this execution.
- treatNullAsZero BOOLEAN optional - default value is FALSE
- TRUE: If the resulting value is null, 0d value is returned. It is used when the calculation contains a division operation so we can convert the result of the formula to null.
- FALSE: If the resulting value is null, near zero value is returned instead so we can convert the result of the formula to null.
Returns
The represented value of the location
Double
Example
select([m/ 100], true)
select([m/ 100], false)
select([m/ 100])
select()
sum
Special operation used for a list of locations. This is a shortcut to resolving each location and summing them.
Signature
sum(locations ILocation[])
Parameters
locations ILocation[] - represents the tuple locations of all the hierarchies in the modelthat is intended for this execution
Returns
value
Double
Example
sum(list([m/ 100], [h/ Resource]:[m/ 3200]))
Strings
Functions for string manipuilation.
charAt
Returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the sequence is at index 0, the next at index 1, and so on, as for array indexing.
If the char value specified by the index is a surrogate, the surrogate value is returned.
Signature
charAt(self String, index INT)
Parameters
- self String - null
- index INT - the index of the char value
Returns
The char value at the specified index of this string.
The first char value is at index 0.
String
Example
charAt("Any string", 2)
concat
Concatenates the items passed into a single string.
final var parent = "parent"
concat(new String[]{ "10-", parent, "-00" }) returns "10-parent-00"
concat(new String[]{ "10-", parent, null }) returns "10-parent"
Signature
concat(items String[])
Parameters
items String[] - list of items to concatenated
Returns
A string that represents the concatenation of the passed items
String
Example
concat(list("2020M01", "2020M02"))
contains
Returns true if and only if this string contains the specified sequence of char values.
Signature
contains(self String, s String)
Parameters
- self String - null
- s String - the sequence to search for
Returns
True if this string contains s, false otherwise
BOOLEAN
Example
contains("2020M01", "20")
endsWith
Tests if this string ends with the specified suffix.
Signature
endsWith(self String, suffix String)
Parameters
- self String - null
- suffix String - the suffix
Returns
true if the character sequence represented by the argument is a suffix of the character sequence represented by this object; false, otherwise.
Note that the result will be true if the argument is the 1 startsWith("2020M01", "2020") empty string or is equal to this String, object as determined by the (Object) method.
BOOLEAN
Example
endsWith("2020M01", "01")
equals
Signature
equals(a String, b String)
Parameters
- a String - null
- b String - null
Returns
null
BOOLEAN
Example
equals("2020M01", "2020M02")
isEmpty
Returns true if, and only if, length is 0.
Signature
isEmpty(self String)
Parameters
self String - null
Returns
true, if length is 0, otherwise false
BOOLEAN
Example
isEmpty("Any string")
left
Returns a string that is a substring of this string. The substring begins at the specified 0 index and extends to the character at index count. Thus, the length of the substring is count.
Examples:
substring("2020M01", 4) returns "2020"
Signature
left(self String, count INT)
Parameters
- self String - null
- count INT - the number of characters to return from the beginning
Returns
The specified substring.
String
Example
left("2020M01", 4)
length
Returns the length of this string.
The length is equal to the number of Unicode code units in the string.
Signature
length(self String)
Parameters
self String - null
Returns
The length of the sequence of characters represented by this object.
INT
Example
length("Any string")
right
Returns a string that is a substring of this string.
The substring begins at the specified self.length() - count and extends to the character at index self.length(). Thus, the length of the substring is count.
Examples:
1 substring("Any string", 2, 5)
1 left("2020M01", 4)
substring("2020M01", 2) returns "01"
substring("2020M01", 2) returns "01"
Signature
right(self String, count INT)
Parameters
- self String - null
- count INT - the number of characters to return from the end
Returns
The specified substring.
String
Example
right("2020M01", 2)
startsWith
Tests if this string starts with the specified prefix.
Signature
startsWith(self String, prefix String)
Parameters
- self String - null
- prefix String - the prefix.
Returns
true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise.
Note also that true will be returned if the argument is an empty string or is equal to this String object as determined by the (Object), method.
BOOLEAN
Example
startsWith("2020M01", "2020")
substring
Returns a string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.
Examples:
substring("unhappy", 2) returns "happy"
substring("Harbison", 3) returns "bison"
substring("emptiness", 9) returns "" (an empty string)
Signature
substring(self String, beginIndex INT)
Parameters
self String - null
beginIndex INT - the beginning index, inclusive.
Returns
The specified substring.
String
Example
substring("Any string", 2)
substring
Returns a string that is a substring of this string.
The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus, the length of the substring is endIndex-beginIndex.
Examples:
substring("hamburger", 4, 8) returns "urge"
substring("smiles", 1, 5) returns "mile"
Signature
substring(self String, beginIndex INT, endIndex INT)
Parameters
- self String - null
- beginIndex INT - the beginning index, inclusive
- endIndex INT - the ending index, exclusive
Returns
The specified substring.
String
Example
substring("Any string", 2, 5)
toLowerCase
Converts all the characters in this String to lower case using the rules of the default locale. This is equivalent to calling toLowerCase(Locale.getDefault()).
Note: This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently.
Examples are programming language identifiers, protocol keys, and HTML tags.
For instance, "TITLE".toLowerCase(), in a Turkish locale returns "t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. To obtain correct results for locale insensitive strings, use toLowerCase(Locale.ROOT).
Signature
toLowerCase(self String)
Parameters
self String - null
Returns
The String converted to lowercase.
String
Example
toLowerCase("STRING")
toUpperCase
Converts all the characters in this String, to upper case using the rules of the default locale.
This method is equivalent to toUpperCase(Locale.getDefault()).
Note: This method is locale sensitive, and may produce unexpected results if used for strings that are intended to be interpreted locale independently.
Examples are programming language identifiers, protocol keys, and HTML tags.
For instance, "title".toUpperCase(), in a Turkish locale returns "T\u0130TLE", where '\u0130' is the LATIN CAPITAL LETTER I WITH DOT ABOVE character. To obtain correct results for locale insensitive strings, use toUpperCase(Locale.ROOT).
Signature
toUpperCase(self String)
Parameters
self String - null
Returns
The String converted to uppercase.
String
Example
toUpperCase("string")
trim
Returns a string whose value is this string, with all leading and trailing space removed, where space is defined as any character whose codepoint is less than or equal to 'U+0020' (the space character).
If this String} object represents an empty character sequence, or the first and last characters of character sequence represented by this String, object both have codes that are not space (as defined above), then a reference to this String object is returned.
Otherwise, if all characters in this string are space (as defined above), then a String object representing an empty string is returned.
Otherwise, let k be the index of the first character in the string whose code is not a space (as defined above) and let m be the index of the last character in the string whose code is not a space (as defined above). A String, object is returned, representing the substring of this string that begins with the character at index k and ends with the character at index m -that is, the result of this.substring(k, m + 1).
This method may be used to trim space (as defined above) from the beginning and end of a string.
Signature
trim(self String)
Parameters
self String - null
Returns
a string whose value is this string, with all leading and trailing space removed, or this string if it has no leading or trailing space.
String
Example
trim(" Any string ")