Mathematical functions are used for a variety of mathematics-oriented calculations and operations.
Returns the absolute value of a BigInt value. If the argument is not negative, the argument will be returned. If the argument is negative, the negation of the argument will be returned.
Parameter
a - A BigInt value.
Return value
The return value is an Integer.
Example
The return value of the following statements is 3534.
Abs(-3534) and Abs(3534)
Returns the absolute value of a Currency value. If the argument is not negative, the argument will be returned. If the argument is negative, the negation of the argument will be returned.
Parameter
a - A Currency value.
Return value
The return value is a Currency.
Example
The return value of the following statement is $3.67.
Abs($3.67) and Abs($-3.67)
Returns the absolute value of a Double value. If the argument is not negative, the argument will be returned. If the argument is negative, the negation of the argument will be returned.
Parameter
a - A Double value.
Return value
The return value is a Number.
Example
The return value of the following statements is 2.4785.
Abs(2.4785) and Abs(-2.4785)
Returns a number specifying the arctangent of the given number parameter. In other words, it returns the angle whose tangent is the given number parameter. This function works in a similar way to the Java Math function with the same name. The range of values returned by atan is between -pi/2 and pi/2 radians.
Parameter
number - A Number value.
Return value
Number value, which is an angle specified in number of radians.
Example
atan(1)
- Returns an angle of 0.7854 radians (rounded to 4 radians). To convert this angle to degrees multiply by 180 / pi. For instance, atan (1) * 180 / pi is 45 degrees.
The function is used to get the average value of the values referred to by the argument.
Parameter
a - Values of DBField or formula field. Can be Number or Currency data type.
Return value
The return value can be Number or Currency.
Examples
Number x = Average(@dbfield)
Number x = Average(@formula)
Currency x = Average(@dbfield)
Currency x = Average(@formula)
This function is used to get the average value of values referred to by the argument.
Parameters
Return value
The result value can be Number or Currency, and is depent on the data type of the first argument respectively.
Examples
Number x = Average(@dbfield, @dbfield_groupby)
Number x = Average(@dbfield, @formula_groupby)
Number x = Average(@dbfield, @parameter_groupby)
Currency x = Average(@formula, "group_field")
Currency x = Average(@formula, @formula_groupby)
Currency x = Average(@formula, @parameter_groupby)
This function computes the average of all the values in the array.
Parameter
a - A Number or Currency array.
Return value
The return value is a Number or a Currency.
Examples
Number x = Average([ 11,12,13,14,15,16 ])
Number x = Average([ -11, -12, -13, -14, -15, -16 ])
Number x = Average([ 11.25,11.26,11.27,11.28 ])
Number x = Average([ -11.25, -11.26, -11.27, -11.28 ])
Currency x = Average([ $5.6, $5.7, $5.8, $5.9 ])
Currency x = Average([ -$5.6, -$5.7, -$5.8, -$5.9 ])
Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. The following formula will then be treated as incorrect.
Number x = @dbfield;
Number y = Average(x); // system will prompt you that there is no such kind of function.
Returns a number specifying the cosine of an angle given in radians. It takes a right-angle triangle, and returns the length of the side adjacent to the specified angle divided by the length of the hypotenuse.
Parameter
number - An angle in number of radians.
Return value
Number value between 1 and -1.
Examples
cos(1)
- Returns 0.54 (rounded to 2 decimals). This is the cosine of 1 radian.cos(60 * pi / 180)
- Returns 0.5. This is the cosine of 60 degrees. Before taking the cosine, the angle is converted to radians by multiplying by pi / 180.This function computes the number of the values in an array.
Parameter
a - A Double array.
Return value
The return value is an Integer.
Examples
Count([11.2, 15.4, 13.7, 16.9, 15.2, 14.8, 10.6])
- Returns 7.Count([-20.4, -26.4, -68.7, -84.1])
- Returns 4.Count(["George","Paul","George","John","Ringo","John"])
- Returns 6. Count([11, 15, 13, 16, 15, 14, 10])
- Returns 7.Count([$1, $2, $3.0, $4.5, $45, $67])
- Returns 6.The function is used to count the number of values referred to by the argument.
Parameter
a - Values of DBField or formula field.
Return value
Returns a Number type value.
Examples
Number x = Count(@dbfield)
Number x = Count(@formula)
The function is used to count the number of values referred to by the first argument.
Parameters
Return value
Returns a Number type value.
Examples
Number y = Count(@"Customer Name", @Customers_Region)
Number x = Count(@formula, @formula_groupby)
Number x = Count(@dbfield, @parametger_groupby)
Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. The following formula will then be treated as incorrect.
Number x = @dbfield;
Number y = Count(x); // system will prompt you that there is no such kind of function.
This function computes the number of distinct values referred to by a DBField.
Parameter
a - Values of a DBField or a formula field.
Return value
The return value is an Integer.
Example
If you build a report about customer order, the return value of the following statement is 19.
DistinctCount(@"Order Date")
This function is used to count the number of distinct values referred to by the first argument.
Parameters
Return value
Returns a Number type value.
Examples
Number x = DistinctCount(@dbfield, @dbfield1)
Number x = DistinctCount(@formula, @formula_groupby)
Number x = DistinctCount(@dbfield, @parameter_groupby)
This function computes the number of distinct values in an array.
Parameter
a - A Number array.
Return value
The return value is an Integer.
Example
The return value of the following statement is 4.
DistinctCount([1.45, 2.63, 38.1, 1.45, 23.9])
Number x = @dbfield;
Number y = DistinctCount(x); // system will prompt you that there is no such kind of function.
Returns the Mathematical value of e, which is 2.7182818 (if rounded to 7 decimal places).
Returns a number specifying e (the base of natural logarithms) raised to a power. The value of e is approximately 2.7182818284590452354. This function works like the Java Math function with the same name. Numeric overflow occurs if the given number parameter is larger than approximately 705.
Parameter
inNumber - Number value that specifies a power.
Return value
A number which is the value of e ^ Number.
Examples
exp(1.5)
- Returns the exponentiation of 1.5, which is approximately 4.4817.exp(10)
- Returns 22,026.47.Returns the integer portion of the value numbera/numberb.
Parameters
Return value
Whole Number value.
Example
integDiv(33, 2)
- Returns 16.
Returns a number specifying the natural logarithm of a given number. The natural logarithm is the logarithm to the base e, where e is approximately 2.7182818284590452354. If the value of number is less than 0, the function will return NaN.
Parameter
number - The Number value that you want to calculate on.
Return value
The number which is the value of ln(Number).
Examples
log(1.5)
- Returns 0.406 (rounded to 3 decimals).log(22026.47)
- Returns 10.This function returns the highest value in an array.
Parameter
a - An array, data type can be Number.
Return value
Returns a Number value.
Example
Maximum([ 22.5, 75.81, 236.47, 56.31, 235.78 ])
This function is used to pick up the maximum value from the values referred to by the argument.
Parameter
a - Values of a DBField or a formula field.
Return value
The returned value type is dependent on the data type of the parameter. It may be Number, Currency, String, Date, Time, DateTime or Boolean.
Examples
Number x = Maximum(@dbfield)
Date x = Maximum(@formula)
Currency x = Maximum(@dbfield)
Boolean x = Maximum(@formula)
This function is used to pick up the maximum value from the values referred to by the first argument.
Parameters
Return value
The returned type is dependent on the data type of the first argument. It may be Number, Currency, String, Date, Time, DateTime or Boolean.
Examples
Time x = Maximum(@dbfield, @dbfield1)
DateTime x = Maximum(@dbfield, @formula_groupby)
String x = Maximum(@dbfield, @parameter_groupby)
Date x = Maximum(@formula, @formula_groupby)
Currency x = Maximum(@formula, @dbfield1)
Currency x = Maximum(@formula, @parameter)
Note: If a field is assigned to another variable, for example x, the variable x will lose the characteristic of representing a group of values. The following formula will then be treated as incorrect.
Number x = @dbfield;
Number y = Maximum(x); // system will prompt you that there is no such kind of function.
This function returns the lowest value in an array.
Parameter
a - An array which type can be Number.
Return value
Returns a Number value.
Examples
Number x = Minimum([ 2.36, 0.12, 1.25, 0.25 ])
Number x = Minimum([1.0, 2.0, 3.0, 4.5, 45.0, 67.0])
Number x[6] = [1.0, 2.0, 3.0, 4.5, 45.0, 67.0];
Number y = Minimum(x)
This function is used to pick up the minimum value from the values referred to by the argument.
Parameter
a - Values of a DBField or a formula field.
Return value
The returned value type is dependent on the data type of the parameter. It can be Number, Currency, String, Date, Time, DateTime or Boolean.
Examples
Number x = Minimum(@dbfield)
Date x = Minimum(@formula)
Currency x = Minimum(@dbfield)
Boolean x = Minimum(@formula)
This function is used to pick up the minimum value from the values referred to by the first argument.
Parameters
Return value
The returned value type is dependent on the first argument. It may be Number, Currency, String, Date, Time, DateTime or Boolean.
Examples
Time x = Minimum(@dbfield, @dbfield_groupby)
DateTime x = Minimum(@dbfield, @dbfield_groupby)
String x = Minimum(@dbfield, @parameter_groupby)
Date x = Minimum(@formula, @formula_groupby)
Currency x = Minimum(@formula, @dbfield_groupby)
Currency x = Minimum(@formula, @parameter)
Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. The following formula will then be treated as incorrect.
Number x = @dbfield;
Number y = Minimum(x); // system will prompt you that there is no such kind of function.
Returns a number that is a multiple of the second parameter and at the same time is nearest to the first parameter. This function rounds up (away from zero) if the remainder of the division is greater than or equal to half of the value of the second parameter.
Overloads
MRound(Number,Number)
MRound(Currency,Number)
MRound(Currency,Currency)
Parameters
Note: Regardless of the positive/negative sign of the second parameter, the result of the function takes the positive/negative sign of the first parameter.
Return value
A number.
Expression
Take MRound(Currency,Number) for an example:
MRound(Currency,Number) = Number*(Integer(Currency/Number) + (1 if Remainder(Currency/Number) >=Number/2, otherwise 0)
Examples
Returns the Mathematical value of pi, which is 3.1415926 (if rounded to 7 decimal places).
This function computes the population standard deviation of the values referred to by the argument.
Parameters
Return value
Returns a Number type value.
Examples
Number x = PopulationStdDev([1.0, 2.0, 3.0, 4.5, 45.0, 67.0])
Number x[6] = [1.0, 2.0, 3.0, 4.5, 45.0, 67.0];
Number y = PopulationStdDev( x)
Number x = PopulationStdDev(@dbfield)
Number x = PopulationStdDev(@formula)
Number x = PopulationStdDev(@dbfield, @dbfield1)
Number x = PopulationStdDev(@dbfield, @"group_field")
Number x = PopulationStdDev(@dbfield, @parameter)
Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. Therefore, the following formula will be treated as incorrect.
Number x = @dbfield;
Number y = PopulationStdDev(x); // system will prompt you that there is no such kind of function.
This function computes the population variance of the values referred to by the argument.
Parameters
Return value
Returns a Number type value.
Examples
PopulationVariance([ 2.5, 4.75, 2.36, 1.25 ])
Number x = PopulationVariance([1.0, 2.0, 3.0, 4.5, 45.0, 67.0])
Number x[6] = [1.0, 2.0, 3.0, 4.5, 45.0, 67.0];
Number y = PopulationVariance(x)
Number x = PopulationVariance(@dbfield)
Number x = PopulationVariance(@formula)
Number x = PopulationVariance(@dbfield, @dbfield_groupby)
Number x = PopulationVariance(@dbfield, @formula_groupby)
Number x = PopulationVariance(@dbfield, @parameter)
Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. Therefore, the following formula will be treated as incorrect.
Number x = @dbfield;
Number y = PopulationVariance(x); // system will prompt you that there is no such kind of function.
Returns the value of numbera ^ numberb.
Paremeters
Examples
pow(2, 4)
- Returns 16.pow(6.2, 5.1)
- Returns 10995.060323919315.Returns a random number greater than or equal to 0 and less than 1. If seed is equal to 0, Random returns the random number that was returned from the previous call to random. If seed is not supplied or is greater than 0, then Random will return the next random number in the internally generated sequence of random numbers. If seed is less than 0, then Random will use this value of seed to start a new random number sequence and returns the first value in the sequence. This function is typically used when your formula requires a randomly generated number, for example, statistical calculations or selecting records at random to limit the data in a report.
Overloads
Parameter
seed - An optional Number value parameter.
Return value
A Number value.
Examples
random()
- Returns: 0.673411041443785random(123)
- Returns: 0.06300625845328678random(0)
- Returns: 0.06300625845328678random(-122223)
- Returns: 0.3291484275937213Note: You can call Random without ever starting a new random number sequence by specifying a negative seed parameter. If you do so, an internal seed will be generated using the system clock. The reason to start a new random number sequence by calling Random with a negative seed parameter, and then making subsequent calls to Random without a parameter (or with a positive parameter) is so that the report will look exactly the same every time it is previewed. In other words, it allows you to make use of random numbers, but to return a reproducible result.
This function is used to evaluate the remainder after numerator has been divided by a denominator.
Parameters
Return value
The return value is an Integer.
Examples
Remainder(7, 9)
- Returns 7. if(Remainder(@"CustomerID",2)==0) then
return "0xffcc99"
else
return "0xccffff"
This formula can distinguish odd numbers and even their backgrounds.
This function returns the integer portion after a specified number has been rounded.
Parameter
a - A Double value.
Return value
The return value is an Integer.
Example
The return value of the following statement is 3.00.
Round(2.754)
This function is used to round to a specified scale determined by argument b for Double value a.
Parameters
Return value
The return value is a Number.
Example
The return value of the following statement is 2.46.
Round(2.4576, 2)
This function is used to round to a specified scale determined by argument b and a specified rounding mode determined by argument c for Double value a.
Parameters
c is used to represent the following different seven rounding modes, which can be specified as an integer between 0 and 6.
Return Value
The return value is a Number.
Example
The return value of the following statement is 2.03.
Round(2.021, 2, 0)
This function is use to round to a specified scale determined by argument b using the rounding mode c.
Parameters
Return Value
The return value is a number.
Example
The return value of the following statement is 123.457.
Round(123.4567, 3, 'UP')
Function
Description
This function takes the average of all the numerical values in a field on running records. For details about the arguments, return type, and examples, refer to Average().
Function
Description
This function takes a total count on running records of the values in a field. For details about the arguments, return type, and examples, refer to Count().
Function
Description
This function takes a total count of all the distinct fields in a report on running records. For details about the arguments, return type, and examples, refer to DistinctCount().
Function
Description
This function finds the largest numerical value in a field on running records. For details about the arguments, return type, and examples, refer to Maximum().
Function
Description
This function finds the smallest numerical value in a field on running records. For details about the arguments, return type, and examples, refer to Minimum().
Function
Description
This function sums up all the numerical values in a field on running records. For details about the arguments, return type, and examples, refer to Sum().
Returns the sign value of the given number (whose value is data). If data is greater than 0, it will return 1. If data is less than 0, it will return -1. If data is equal to 0, it will return 0.
Parameter
data - The value you want to know the sign of.
Return value
1, 0 or -1.
Examples
sgn(2)
- Returns 1.sgn(-23)
- Returns -1.sgn(0)
- Returns 0.Returns a number specifying the sine of an angle given in radians. It takes a right-angle triangle, and returns the length of the side opposite to the specified angle divided by the length of the hypotenuse.
Parameter
number - An angle in number of radians.
Return value
Number value between -1 and 1.
Examples
sin(1)
- Returns 0.84 (rounded to 2 decimals). This is the sine of 1 radian.sin(60*pi/180)
- Returns 0.87 (rounded to 2 decimals). This is the sine of 60 degrees. Before taking the sine, the angle is converted to radians by multiplying by pi/180.Returns the square root of a given number. If the value of the number is less than 0, this function returns NaN. It is designed to work like the Java Math function of sqrt().
Parameter
number - A Number value greater than or equal to 0.
Return value
Number value.
Example
sqr(100)
- Returns 10.
This function computes the standard deviation of the values referred to by the argument.
Parameters
Return value
Returns a Number value.
Examples
Number x = StdDev([1.0, 2.0, 3.0, 4.5, 45.0, 67.0])
Number x[6] = [1.0, 2.0, 3.0, 4.5, 45.0, 67.0];
Number y = StdDev( x)
Number x = StdDev(@dbfield)
Number x = StdDev(@formula)
Number x = StdDev(@dbfield, @dbfield1)
Number x = StdDev(@dbfield, @formula_groupby)
Number x = StdDev(@dbfield, @parameter)
Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. The following formula will then be treated as incorrect.
Number x = @dbfield;
Number y = StdDev( x); // system will prompt you that there is no such kind of function.
This function computes the sum of all the values referred to by the argument.
Parameters
Return value
The returned value type is dependent on the parameter. It can be Number, Integer or Currency.
Examples
Number x = Sum([1, 2, 3.0, 4.5, 45, 67])
Number x[6] = [1, 2, 3.0, 4.5, 45, 67];
Number y = Sum(x)
Currency x = Sum([$1, $2, $3.0, $4.5, $45, $67])
Currency x[] = [$1, $2, $3.0, $4.5, $45, $67];
Currency y = Sum(x)
Number x = Sum(@dbfield)
Number x = Sum(@formula)
Number x = Sum(@dbfield, @dbfield_groupby)
Number x = Sum(@dbfield, @formula_groupby)
Number x = Sum(@dbfield, @parameter)
Currency x = Sum(@dbfield)
Currency x = Sum(@formula)
Currency x = Sum(@formula, @dbfield_groupby)
Currency x = Sum(@formula, @formula_groupby)
Currency x = Sum(@formula, @parameter)
Note: If a field is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. So, the following formula will be treated as incorrect.
Number x = @dbfield;
Number y = Sum( x); // system will prompt you that there is no such kind of function.
Returns a number specifying the tangent of an angle given in radians. It takes a right-angle triangle, and returns the length of the side opposite the specified angle divided by the length of the side adjacent to the angle.
Parameter
number - An angle in the form of number of radians.
Return value
Number value.
Examples
tan(1)
- Returns 1.5574 (rounded to 4 decimals). This is the tangent of 1 radian.tan(45 * pi / 180)
- Returns 1.0. This is the tangent of 45 degrees. Before taking the tangent, the angle is first converted to radians by multiplying it with pi/180.This function changes a specified integer to its binary form.
Parameter
a - A BigInt value.
Return value
The return value is a String.
Example
The return value of the following statement is 1011.
ToBinary(11)
This function returns the HEX form of a specified value.
Parameter
a - A BigInt value.
Return value
The return value is a String.
Example
The return value of the following statement is 20.
ToHex(32)
This function changes a specified number to an Integer.
Parameter
a - A Number value.
Return value
The return value is an Integer.
Example
The return value of the following statement is 100.
ToInt(100.1)
This function returns the octal form of a specified value.
Parameter
a - A BigInt value.
Return value
The return value is a String.
Example
The return value of the following statement is 64.
ToOctal(52)
This function returns a number by truncating the decimal portion.
Parameter
a - A Double value to be truncated.
Return value
The return value is a Number.
Example
The return value of the following statement is 25.00.
Truncate(25.4321)
This function returns a number by truncating the number at the decimal point. The number is truncated to the decimal place indicated by argument b, and the function returns a fractional number.
Parameters
Return value
The return value is a Number.
Example
The return value of the following statement is 25.430.
Truncate(25.432, 2)
This function computes the variance of all the values referred to by the argument.
Parameters
Return value
Returns a Number type value.
Examples
Number x = Variance([1.0, 2.0, 3.0, 4.5, 45.0, 67.0])
Number x[6] = [1.0, 2.0, 3.0, 4.5, 45.0, 67.0];
Number y = Variance(x)
Number x = Variance(@dbfield)
Number x = Variance(@formula)
Number x = Variance(@dbfield, @dbfield_groupby)
Number x = Variance(@dbfield, @formula_groupby)
Number x = Variance(@dbfield, @parameter)
Note: If a field_variable is assigned to a variable, for example x, the variable x will lose the characteristic of representing a group of values. So, the following formula will be treated as incorrect.
Number x = @dbfield;
Number y = Variance(x); // system will prompt you that there is no such kind of function.