This section contains brief descriptions of the functions that apply to float or integer values.
Function | What it does |
---|---|
abs | Returns the absolute value of the numeric function. |
bitor, bitand, bitnot | Provides Boolean manipulation of bits. |
convert | Converts a number to another data type or converts another data type to a number. |
err_encode | Converts a three-part FileNet® P8 error tuple into a single-part integer. |
int | Truncates everything after the decimal point and returns the integer value of a numeric expression. |
max | Returns the largest value from a list of expressions of any supported data type. |
min | Returns the smallest value from a list of expressions of any supported data type. |
mod | Returns the remainder after division (modulus). |
numbertostring | Converts a numeric expression to a string expression, using a specified mask. |
random | Returns a random integer within a specified range. |
sizeof | Returns the size of an array. |
abs (num_expr)
where num_exp is an expression whose result is of type
integer or float. For example:abs (SalePrice - PurchasePrice)
These functions provide Boolean manipulation of bits; use them to perform many tasks, such as masking setting, and extracting bits. Each of these functions can perform Boolean operations on up to 32 items at the same time.
If you are familiar with the 'C' programming language, then bitand, bitor, and bitnot are like logical and (&), logical or (|), and logical not (~), respectively. If you are not familiar with 'C', then consider the numbers to be binary values (for example, 123 would be 1111011).
bitand (expr1, expr2)
bitor (expr1, expr2)
bitnot (expr)
where expr1
and expr2 are integers of 32 bits.bitand
(00000000000000000000000001111011,
00000000000000000000000011110000)
results in:
00000000000000000000000001110000
bitor
(00000000000000000000000001111011,
00000000000000000000000011110000)
results in:
00000000000000000000000011111011
The bitnot function "nots" an integer; the result of this bit-by-bit analysis is output to a new integer. For each position, the new integer contains the opposite bit value-meaning, for example, that if the input integer contains a 1 in a given position, the new integer contains a 0 in the same position.
bitnot
(00000000000000000000000001111011
results in:
11111111111111111111111110000100
This function computes the integer value of a float expression by truncating everything after the decimal point. For example, the float values 6.2 and 6.8 are converted to the integer value 6. The sign of the number does not change.
int (num_expr)
where num_expr is an expression
whose result is of type float. For example:int (365 / 7)
This function returns the remainder after division (modulus). Note that if you try to divide a value by zero, a runtime error occurs.
mod (num1, num2)
where num1 and num2 are variables
of type float or integer, and can contain negative values.mod (NumberOfDays, 7)
If num2 > 0,
0 <= mod (num1, num2) < num2
If num2 < 0,
num2 < mod (num1, num2) <= 0
Some applications need a way to generate a random integer, perhaps as a means of performing random sampling. This function returns a random integer within a specified range. It requires an integer as a parameter to determine the range.
random (num)
where num is an integer from 2
through 32768 (inclusive of both ends). The range is between 0 and num - 1. In the above example, if
num were 23, the random integer would fall between 0 and 22.This function converts a three-part FileNet P8 error tuple into a integer value, which you can compare to a result code returned by a call to a WorkFlo Application Libraries (WAL) entry point. WAL returns result codes when exception conditions in normal processing occur (such as end-of-file in simple data processing), or when errors occur.
The primary use for err_encode is to base subsequent processing of a work item on the results returned by an operation that calls WAL. Typically, such an operation is followed by a Branch system Instruction; when the Branch executes, the work item follows the processing path determined by the result code that the previous operation returned. For example, use the err_code function in the Branch definition to indicate that if <return code> = err_encode (80, 0, 2), the work item follows one processing path, while it follows another processing path if <return code> = err_encode (80, 0, 5).
err_encode (mod_num, func_num, err_num)
where:Parameter | Description |
---|---|
mod_num | The first part of the result code. It is an integer expression (ranging from 0-255) that indicates which service, library, or application is the source of the error. |
func_num | The second part of the result code. It is an integer expression (ranging from 0-255) that indicates which function or module the error comes from, or the category to which the error belongs. |
err_num | The third part of the result code. It is an integer expression (ranging from 0-65535) that indicates the error number. |