Show TOC

Background documentationNumeric Functions Locate this document in the navigation structure

 

Function

Description

Syntax

Examples

ABS

Returns the absolute value of a given number.

ABS(n)

ABS(-3)

Returns the value of the number without the sign. In this case, the returned value would be 3

CEIL

Rounds a number up to the next integer that is equal to or greater than the number.

CEIL(n)

CEIL(3.14)

Rounds the number up to the next integer. In this case, the returned value would be 4

FLOAT

Converts a text string to a floating-point number.

FLOAT(str)

FLOAT('-3.14')

Returns the digital representation of the floating-point number in the string. In this case, the returned value would be -3.143

FLOOR

Rounds the given number to the highest integer that is equal to or smaller than the number.

FLOOR(n)

FLOOR(3.14)

Rounds the number down to the highest integer. In this case, the returned value would be 3

HEX

Converts a hexadecimal number in a text string to a decimal number.

HEX(str)

HEX('6EA5')

Parses a text string containing a hexadecimal number. In this case, the returned value would be 28325

HEX('100')

This expression would return would return 256

INT

Converts a text string to a integer, rounding it down to the nearest whole number.

INT(str)

INT('100')

Parses a text string containing an integer. In this case, the returned value would be 100

INT('-3.14')

This expression would return would return -3

LIMIT

Constrains a number to the specified range.

LIMIT(lower,n,upper)

where lower is the minimum value that can be returned and upper is the maximum value that can be returned

LIMIT(0,3,10)

If n is less than the lower (first) value, returns the lower value. If n is greater than the upper value, returns the upper value. Otherwise, returns n. In this case, the returned value would be 3

LIMIT(0,13,10)

This expression would return would return 10

MAX

Returns the largest value among a specified set of values.

MAX(n1,n2)

MAX(0,2,3)

Displays the largest value in the set of values. In this case, the returned value would be 3

MIN

Returns the smallest value in a set of values.

MIN(n1,n2)

MIN(0,3,6)

Displays the smallest of the set of values. In this case, the returned value would be 0

NSTR

Returns a formatted string representing the defined number.

NSTR(n,mask)

where mask is a formatted sequence defined according to the Number Formatting Mask table

NSTR(@@,'B')

Displays or hides zero/blank values. In this case, an empty space or a value of 0 would not be displayed.

NSTR(@SD_DOC,'Z')

Displays leading zeroes in the field value. In this case, if @SD_DOC contains 10 characters in the string, the number 1432 would be displayed as 0000001432

NSTR(@@,'10.2')

Rounds off a long decimal output to a two-place decimal value. In this case, if the value of the current field is 142.3213762, the following value would be displayed: 142.32

NSTR(@TOTAL_PRICE,'C')

Adds a comma separator to values in the thousands. In this case, if the value of @TOTAL_PRICE is 682328, the following value would be returned: 682,328

Note Note

To concatenate two numbers, use the NSTR function with Logical AND, as in this example: NSTR(@FIRST,NORMAL)&NSTR(@SECOND,NORMAL).

In this case, returned values of 2 and 4 would result in a value of 24 being displayed.

End of the note.

NVAL

Converts a text string to a numeric value where possible.

NVAL(str)

NVAL('0xFF')

Parses a text string and returns a decimal number, where possible. In this case, the returned value would be 255.

NVAL('83')

This expression would return would return 83

NVAL('holiday')

This expression would return would return 0

POS

Converts a text string to a positive integer number.

POS(str)

POS('100')

Parses a text string and returns a positive integer. In this case, the returned value would be 100

POS('-3.14')

This expression would return would return 0

RND

Returns a random number that is greater than or equal to zero and less than or equal to the given maximum value.

RND(max)

where max is the top value in the range

RND(68)

Returns a random integer between 0 and the given number. In this case, a returned value might be:

7 or 34

ROUND

Returns the integer value closest to the given number.

ROUND(n)

ROUND(11.75)

Rounds the given number up or down, to return the closest integer. In this case, the returned value would be: 12

ROUND(11.50)

This expression would return would return 12

POS(11.25)

This expression would return would return 11

SIGN

Returns the sign of the given number.

SIGN(n)

SIGN(13)

If number is less than 0, returns -1. If number is greater than 0, returns 1. Otherwise, returns 0. In this case, the returned value would be 1

SIGN(-5.3)

This expression would return would return -1