Abs()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

Abs()

Syntax

Abs( <NumericValue> )

 

Purpose                

Abs() is a numeric function that returns the absolute value of a numeric field or numeric expression involving one or more fields. The absolute value of a number is simply the number with any negative sign removed. That is, a negative quantity would be converted to a positive quantity of the same magnitude. The absolute value of a positive number is exactly equal to the number itself.

 

Parameters

A numeric value to return the absolute value of.

 

Returns

A numeric value that is the absolute value of the number you give to the Abs() function.

 

Usage

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.

 

The Abs() function has rather limited application in DonorQuest -- it is more of a mathematical function than anything else. However, it could be useful in reports if you wish to force a numeric column to only display the magnitude of amounts, effectively converting negative amounts to positive ones.

 

Example

The following examples illustrate Abs():

 

CALL

RESULT

Abs( -1 )

1

Abs( 0 )

0

Abs( 1 )

1

Abs( -25.00 )

25

Abs( 25.00 )

24

 

When defining selection conditions, you may wish to qualify donors based on the absolute difference between their most recent donation and their average donation being greater than some value. For example, lets say we want to qualify all donors with the difference between their most recent donation and their average donation being greater than $500.00. The following selection condition:

 

Average_Donation_Amount. - .Most_Recent_Donation. > 500

 

would not work if the average donation amount were $250.00 and the most recent donation were $900.00 since the difference would be -650.00, which is not greater than 500. However, the following selection condition employing the Abs() function would work:

 

Abs( .Average_Donation_Amount. - .Most_Recent_Donation. ) > 500