image\Dql_0023.giflastw

Type

Text Function

Purpose

The lastw function extracts a specified number of words from the end (right) of a text value.

Syntax

lastw( TEXT VALUE, n)

Returns

A text value n words in length.

Usage

lastw(FIELDNAME, n) returns the last n words in the field including intervening spaces and punctuation symbols. If there are n or fewer words in the field, lastw returns the original text value.

Examples

lastw( "Sapphire International Ltd." , 2)

Returns: International Ltd.

 

lastw( "Club ParaDEASE" , 1)

Returns: ParaDEASE

 

lastw( STREET, 2)

Returns:The last two words in the STREET field for every record that is processed. If a record contains the value "540 Avenida de los Delfines" in the STREET field, the function returns "los Delfines".