AllTrim()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

AllTrim()

Syntax

AllTrim( <FieldName> )

 

Purpose

To return the characters of a field, less any leading or trailing blank spaces.

 

Parameters

<FieldName> is the name of a field, or any character expression.

 

Returns

A Character value.

 

Usage

This function is intended to be used in situations where you are unsure whether there may be extraneous spaces surrounding the characters in a field, and you wish to compare only the non-space characters of a field against some specific value.

 

Example

You want to know all the donors with a code number of one. You're not sure whether your data entry person has been entering the code one's as "1__", "_1_", or "__1". Normally, you would have to check each of the three cases individually, using an .OR. connector like this:

 

         (.Code. = "1 ") .OR. (.Code. = " 1 ") .OR. (.Code. = " 1")

 

Using the "AllTrim()" function, all you would have to do is remove any leading and trailing blanks from each code field before you compare it to the specific character value "1" like this:

 

         AllTrim( .Code. ) = "1"

 

Note that this would not work if the data entry operator had entered "001" to mean code 1. The zeros are not considered blank spaces, and the "AllTrim()" function would not remove them. In a case where the .Code. field might be "001", it is best to use the "VAL()" function (discussed in the pages to come).