4.13. Miscellaneous functions #

4.13.1. brrownum()
4.13.2. error()
4.13.3. eval()
4.13.4. fxpval()
4.13.5. iif()
4.13.6. isdatetime()
4.13.7. iserror()
4.13.8. isnan()
4.13.9. isnull()
4.13.10. isnumeric()
4.13.11. isstring()
4.13.12. null()
4.13.13. nulldt()
4.13.14. nulln()
4.13.15. nulls()
4.13.16. prevval()
4.13.17. random()
4.13.18. rownum()
4.13.19. translate()
4.13.20. translate2()

4.13.1. brrownum() #

Current row number of a break since its last break boundary. The row number restarts from 1 at every break boundary. It takes one string operand, the name of the break.

4.13.2. error() #

Return an artificially generated error. It takes one string operand, the error message. Used by unit tests but it may be useful in some other cases.

4.13.3. eval() #

Parse an expression string. If it's correct, it is inserted into the parent expression in place of the function call. If there is a syntax error, the error is re-thrown for the main expression. It takes one string operand.

This is a pseudo-function. The grammar detects its use and converts the embedded expression string into a regular subexpression, like if it was inside parenthesis in the parent expression contents. This allows the subexpression to be optimized in the parent expression context.

Fox example, the expression 3 * eval('1 + 2') is optimized into the numeric constant 9.

Note, that the grammar transformation only takes place if there is no user defined function with the same name. In this case, the user defined function is used.

4.13.4. fxpval() #

Move the decimal separator to the left by the specified number of digits. It takes two operands. The first operand may either be a string containing a numeric value, or a numeric. If it's a string, then it will be converted to numeric first. The second operand is numeric.

It is an RLIB compatibility function. The function divides the numeric value of the first operand with 10 to the power of the value of the second operand. One use case is that if the value of the first operand contains prices in cents, then fxpval(data, 2) puts the decimal separator to the correct place.

4.13.5. iif() #

Ternary function. It takes three operands of which the first one is numeric, the second and third operands can be of any type. If the first operand is non-zero (i.e.: "true") then it returns the second operand, otherwise the third operand. The ternary operator exp1 ? exp2 : exp3 is a shortcut for this function.

4.13.6. isdatetime() #

Returns numeric 1 if the operand is datetime, 0 otherwise. It takes one operand of any type.

4.13.7. iserror() #

Returns numeric 1 if the operand is an error, 0 otherwise. It takes one operand of any type.

4.13.8. isnan() #

Returns numeric 1 if the operand is numeric and it represents a NAN value (not-a-number), 0 otherwise. It takes one operand of any type.

4.13.9. isnull() #

Returns numeric 1 if the operand is NULL, 0 otherwise. It takes one operand of any type.

4.13.10. isnumeric() #

Returns numeric 1 if the operand is a numeric value, 0 otherwise. It takes one operand of any type.

4.13.11. isstring() #

Returns numeric 1 if the operand is a string value, 0 otherwise. It takes one operand of any type.

4.13.12. null() #

Generate NULL value using the type of its operand. It takes one operand of any type.

4.13.13. nulldt() #

Generate NULL of the datetime type. It takes zero operands.

4.13.14. nulln() #

Generate NULL of the numeric type. It takes zero operands.

4.13.15. nulls() #

Generate NULL of the string type. It takes zero operands.

4.13.16. prevval() #

Return the previous value. It takes one operand of any type.

The interesting use case for this function is non-constant expressions. It returns the operand's previous value, i.e. the value generated for the previous query row. If there is no previous value row, the result is an error. This function allows showing values carried over from the previous page to be shown in a header section of the current page.

4.13.17. random() #

Generate a pseudo-random numeric value between 0 and 1. It takes zero operands.

4.13.18. rownum() #

Return the row number of a query in the report. It takes either zero operands or one string operand. If zero operands are passed, it returns the current row number of the primary query. If a string operand is passed, then it returns the current row number of the query with that name. See Queries.

4.13.19. translate() #

Translate the operand. It takes one string operand.

This function returns the translated version of the string operand according to translation and locale settings using dgettext() from Gettext.

4.13.20. translate2() #

Translate the operands using singular and plural variants and the number of the object in the statement. It takes three operands. The first two operands are strings, for the singular and plural strings. The third operand is the number that determines which translation form is used.

This function translates its operands according to the translation and locale settings using dngettext() from Gettext.