Math Functions
Mathematical functions are used for a variety of mathematics-oriented calculations and operations.
Below is a list of the mathematical functions used in Logi JReport Designer:
- Abs()
- atan()
- Average()
- cos()
- Count()
- DistinctCount()
- e()
- exp()
- integDiv()
- log()
- Maximum()
- Minimum()
- MRound()
- pi()
- PopulationStdDev()
- PopulationVariance()
- pow()
- random()
- Remainder()
- Round()
- RunningAvg()
- RunningCount()
- RunningDistinctCount()
- RunningMaximum()
- RunningMinimum()
- RunningSum()
- sgn()
- sin()
- sqr()
- StdDev()
- Sum()
- tan()
- ToBinary()
- ToHex()
- ToInt()
- ToOctal()
- Truncate()
- Variance()
Abs()
Abs(BigInt, a)
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)
Abs(currency, a)
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)
Abs(double, a)
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)
atan(number)
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.
Average()
Average(DBField a)
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)
Average(DBField a, String groupby)
This function is used to get the average value of values referred to by the argument.
Parameters
- a - Values of DBField or formula field. Can be Number or Currency data type.
- groupby - A constant string to indicate the groupby field name or a field variable grouped by or a parameter variable grouped by.
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)
Average(Number a[])
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
- The return value of the following statement is 13.5.
Number x = Average([ 11,12,13,14,15,16 ])
- The return value of the following statement is -13.5.
Number x = Average([ -11, -12, -13, -14, -15, -16 ])
- The return value of the following statement is 11.265.
Number x = Average([ 11.25,11.26,11.27,11.28 ])
- The return value of the following statement is -11.265.
Number x = Average([ -11.25, -11.26, -11.27, -11.28 ])
- The return value of the following statement is 5.75.
Currency x = Average([ $5.6, $5.7, $5.8, $5.9 ])
- The return value of the following statement is -5.75.
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.
cos(number)
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.
Count()
Count(Array a[ ])
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.
Count(DBField a)
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)
Count(DBField a, String groupby)
The function is used to count the number of values referred to by the first argument.
Parameters
- a - Values of DBField or formula field.
- groupby - A constant string to indicate the groupby DBField name, formula name grouped by or a parameter name grouped by.
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.
DistinctCount()
DistinctCount(DBField a)
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")
DistinctCount(DBField a, String groupby)
This function is used to count the number of distinct values referred to by the first argument.
Parameters
- a - Values of a DBField or a formula field.
- groupby - A constant string to indicate the DBField name, formula name or parameter name grouped by.
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)
DistinctCount(Number a[ ])
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.
e()
Returns the Mathematical value of e, which is 2.7182818 (if rounded to 7 decimal places).
exp(Number)
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.
integDiv(numbera, numberb)
Returns the integer portion of the value numbera/numberb.
Parameters
- numbera - A Number value.
- numberb - A Number value.
Return value
Whole Number value.
Example
integDiv(33, 2)
- Returns 16.
log(number)
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.
Maximum()
Maximum(a[ ])
This function returns the highest value in an array.
Parameter
a - An array, data type can be Number or Integer.
Return value
Returns a Number or Integer value according to the data type of the parameter a.
Examples
Maximum([ 22.5, 75.81, 236.47, 56.31, 235.78 ])
Maximum([ 4, 9, 34, 80, 200 ])
Maximum(DBField a)
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)
Maximum(DBField a, String groupby)
This function is used to pick up the maximum value from the values referred to by the first argument.
Parameters
- a - Values of a DBField or of a formula field.
- groupby - A constant string to indicate the DBField name, formula or parameter grouped by.
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.
Minimum()
Minimum(a[ ])
This function returns the lowest value in an array.
Parameter
a - An array, data type can be Number or Integer.
Return value
Returns a Number or Integer value according to the data type of the parameter a.
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])
Integer x = Minimum([ 4, 9, 34, 80, 200 ])
Number x[6] = [1.0, 2.0, 3.0, 4.5, 45.0, 67.0];
Number y = Minimum(x)
Minimum(DBField a)
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)
Minimum(DBfield a, String groupby)
This function is used to pick up the minimum value from the values referred to by the first argument.
Parameters
- a - Values of a DBField or a formula field.
- groupby - A constant string to indicate the DBField name, formula or parameter grouped by.
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.
MRound()
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
- Number - A Number value.
- Currency - A Currency value.
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
- MRound(11.0,4.0) - Return 12.0.
- MRound($11.0,-4.0) - Return 12.0.
- MRound($-7.0,$2.0) - Return -8.0.
pi()
Returns the Mathematical value of pi, which is 3.1415926 (if rounded to 7 decimal places).
PopulationStdDev()
- PopulationStdDev(a[ ])
- PopulationStdDev(DBField field)
- PopulationStdDev(DBField field, String groupby)
This function computes the population standard deviation of the values referred to by the argument.
Parameters
- a - A Number array.
- field - Values of a DBField or formula field.
- groupby - A constant string to indicate the DBField, formula or parameter grouped by.
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.
PopulationVariance()
- PopulationVariance(a[ ])
- PopulationVariance(DBField field)
- PopulationVariance(DBField field, String groupby)
This function computes the population variance of the values referred to by the argument.
Parameters
- a - A Number array.
- field - Values of a DBField or formula field.
- groupby - A constant string to indicate the DBField, formula or parameter grouped by.
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.
pow(numbera, numberb)
Returns the value of numbera ^ numberb.
Paremeters
- numbera - A Number value.
- numberb - A Number value.
Examples
pow(2, 4)
- Returns 16.pow(6.2, 5.1)
- Returns 10995.060323919315.
random(), random(seed)
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
- random()
- random(seed)
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.3291484275937213
Note: 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.
Remainder(Integer a, Integer b)
This function is used to evaluate the remainder after numerator has been divided by a denominator.
Parameters
- a - An Integer value.
- b - An Integer value.
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.
Round()
Round(Number a)
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)
Round(Number a, integer b)
This function is used to round to a specified scale determined by argument b for Double value a.
Parameters
- a - A Double value.
- b - A Scale value.
Return value
The return value is a Number.
Example
The return value of the following statement is 2.46.
Round(2.4576, 2)
Round(Number a, integer b, integer c)
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
- a - A double value which will be rounded.
- b - The rounded scale.
- c - The rounding mode.
c is used to represent the following different seven rounding modes, which can be specified as an integer between 0 and 6.
- ROUND_UP = 0
Rounding mode to round away from zero. Always increments the digit prior to a non-zero discarded fraction. Note that this rounding mode never decreases the magnitude of the calculated value. - ROUND_DOWN = 1
Rounding mode to round towards zero. Never increments the digit prior to a discarded fraction (that is, truncates). Note that this rounding mode never increases the magnitude of the calculated value. - ROUND_CEILING = 2
Rounding mode to round towards positive infinity. If the value is positive, behaves as for ROUND_UP; if negative, behaves as for ROUND_DOWN. Note that this rounding mode never decreases the calculated value. - ROUND_FLOOR = 3
Rounding mode to round towards negative infinity. If the BigDecimal is positive, behave as for ROUND_DOWN; if negative, behave as for ROUND_UP. Note that this rounding mode never increases the calculated value. - ROUND_HALF_UP = 4
Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up. Behaves as for ROUND_UP if the discarded fraction is >= .5; otherwise, behaves as for ROUND_DOWN. Note that this is the rounding mode that most of us were taught in grade school. - ROUND_HALF_DOWN = 5
Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. Behaves as for ROUND_UP if the discarded fraction is > .5; otherwise, behaves as for ROUND_DOWN. - ROUND_HALF_EVEN = 6
Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor. Behaves as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for ROUND_HALF_DOWN if it's even. Note that this is the rounding mode that minimizes cumulative error when applied repeatedly over a sequence of calculations
- ROUND_UP = 0
Return Value
The return value is a Number.
Example
The return value of the following statement is 2.03.
Round(2.021, 2, 0)
Round (Number a, Integer b, String c)
This function is use to round to a specified scale determined by argument b using the rounding mode c.
Parameters
- a - A double value which will be rounded.
- b - The rounded scale.
- c - The rounding mode. It can be Up (0), DOWN (1), CEILING (2), FLOOR (3), HALF_UP (4), HALF_DOWN (5), and HALF_EVEN (6). See the previous section about the detailed description of each rounding mode.
Return Value
The return value is a number.
Example
The return value of the following statement is 123.457.
Round(123.4567, 3, 'UP')
RunningAvg()
Function
- RunningAvg(field_variable);
- RunningAvg(field_variable, groupby);
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().
RunningCount()
Function
- RunningCount(field_variable);
- RunningCount(field_variable, groupby);
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().
RunningDistinctCount()
Function
- RunningDistinctCount(field_variable);
- RunningDistinctCount(field_variable, groupby);
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().
RunningMaximum()
Function
- RunningMaximum(field_variable);
- RunningMaximum(field_variable, groupby);
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().
RunningMinimum()
Function
- RunningMinimum(field_variable);
- RunningMinimum(field_variable, groupby);
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().
RunningSum()
Function
- RunningSum(field_variable);
- RunningSum(field_variable, groupby);
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().
sgn(data)
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.
sin(number)
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.
sqr(number)
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.
StdDev()
- StdDev(a[ ])
- StdDev(field)
- StdDev(field, groupby)
This function computes the standard deviation of the values referred to by the argument.
Parameters
- a - A Number array.
- field - Values of DBField or formula field.
- groupby - A constant string which indicates the DBField, formula or parameter grouped by.
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.
Sum()
- Sum(Number a[ ])
- Sum(Integer a[ ])
- Sum(Currency a[ ])
- Sum(DBField field)
- Sum(DBField, String groupby)
This function computes the sum of all the values referred to by the argument.
Parameters
- a - A Number, Integer or Currency array.
- field - Values of DBField or formula field.
- groupby - A constant string which indicates the DBField, formula or parameter grouped by.
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.
tan(number)
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.
ToBinary(Integer a)
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)
ToHex(Integer a)
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)
ToInt(number a)
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)
ToOctal(Integer a)
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)
Truncate()
Truncate(Number a)
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)
Truncate(Number a, Integer b)
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
- a - A Double value to be truncated.
- b - A Double value indicating the number of the decimal places.
Return value
The return value is a Number.
Example
The return value of the following statement is 25.430.
Truncate(25.432, 2)
Variance()
- Variance(Number a[ ])
- Variance(Currency a[ ])
- Variance(DBField field)
- Variance(DBField field, String groupby)
This function computes the variance of all the values referred to by the argument.
Parameters
- a - A Number array.
- field - Values of DBField or formula field.
- groupby - A constant string which indicates the DBField, formula or parameter grouped by.
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.