Database Manager

Numeric functions

abs Function

Returns the absolute value of its argument.

Synopsis

%result = abs(value)

Parameters

Name

Type

Required?

Description

value

number

yes

The value whose absolute value is requested

Returns

  • If value is a positive number or 0, returns value.

  • If value is a negative number, returns the absolute value of value, i.e. with the negative sign removed.

  • If value is a string, returns 0.


bool function

Converts a value into the number 0 or 1.

Synopsis

%bool_value = bool(%some_value)

Parameters

Name

Type

Required?

Description

value

any

yes

The value to convert

Returns

  • If value is an empty string or the number 0 or a string represents the numeric value 0, returns 0.

  • Otherwise, returns 1.


integer function

Converts a value into a number.

Synopsis

%num = integer(%string_variable)

Parameters

Name

Type

Required?

Description

value

any

yes

The value to convert

Returns

  • If value is a number, returns number.

  • If value is a string which can be interpreted as a number, it returns number converted to a number.

  • Otherwise, returns 0.


min, max functions

Returns the smallest (min) or largest (max) value from its parameter list.

Synopsis

%smallest = min(value1, value2, ...)
%largest = max(value1, value2, ...)

Parameters

Both functions require at least one parameter; and number of additional parameters is allowed. Parameter values which cannot be converted into a number are replaced by the number 0.

Returns

  • min returns the smallest value of all its parameters.

  • max returns the largest value of all its parameters.


pow function

Calculates the power of a number.

Synopsis

%result = pow(2, 3) // returns 8

Parameters

Name

Type

Required?

Description

base

number

yes

The base of the power

exponent

number

yes

The exponent of the power

Returns

The base, taken to the exponent-th power, rounded towards zero to the nearest integer.

Behaviour is undefined in case of arithmetic overflow.


random function

Generates a random number within the specified limits.

Synopsis

%rnd = random(10, 20)

Parameters

Name

Type

Required?

Description

minimum

number

yes

The lower bound

maximum

number

yes

The upper bound; must be greater than or equal to minimim

Returns

A number randomly chosen between minimum and maximum (including both limits).

Numbers are evenly distributed in the interval, but sequential correlations may exist.