ABS()

Advantage Concepts

Advantage Expression Engine function that returns the absolute value of a numeric expression

Syntax

ABS(<nExp>) à nPositive

Parameters

<nExp>  The numeric expression to be evaluated.

Returns

ABS() returns a number representing the absolute value of its argument. The return value is a positive number or zero.

Description

ABS() is a numeric function that determines the magnitude of a numeric value independent of its sign. It lets you, for example, obtain the difference between two numbers as a positive value without knowing in advance which of the two is larger.

As a formalism, ABS(x) is defined in terms of its argument, x, as follows: if x >= 0, ABS(x) returns x; otherwise, ABS(x) returns the negation of x.

Note Advantage Expression Engine functions can be used in expressions such as record filter expressions and index expressions. They are not necessarily scalars supported within SQL statements. For a list of supported SQL scalar functions, see Supported Scalar Functions.

Examples

The following examples show typical results from ABS():

ABS(100 - 50) // Result: 50

ABS(50 - 100) // Result: 50

ABS(-12) // Result: 12

ABS(0) // Result: 0

See Also

None.