Last_Token()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

Last_Token()

Syntax

Last_Token( <CharacterField>, <Delimiter> )

 

Purpose

To extract the last word from a character field.

 

Parameters

<CharacterField> is the name of any character field in DonorQuest, such as the last or first name field.

 

<Delimiter> is usually a quoted space (" "). In general, <Delimiter> is whatever separates words within the field from which you wish to extract the last word. In most cases, words within fields are separated by a space, but you may also have fields in which commas or semicolons are used to separate words or groups of words.

 

Returns

The last word from within <CharacterField>.

 

Usage

Last_Token() can be used with reports to extract the last word from a field. But its power goes well beyond simply dealing with words within fields. The term "token" really applies to any part of a character field that is delimited by a special character or characters. This ability lets you extract any information you wish from within a field, as long as the information is delimited by a specific sequence of characters.

 

Since the second name field is generally used to store the full name of a partner or spouse (in the case of individual donors) or the name of the contact person for an organization, applying the Last_Token() function to the second name field would return the last name from within the second name field.

 

Example

The following example illustrates the use of Last_Token(). This example is based on an instance of the .Second_Name. being equal to "James A. Smith".

 

CALL

RESULT

.Second_Name.

James A. Smith

Last_Token( .Second_Name., " " )

Smith