TEST( ) function

Returns a logical value indicating whether a specified string occurs at a specific byte position in a record.

Syntax

TEST(byte_position, string)

Parameters

Name Type Description
byte_position

numeric

The sequential number from the left in the table layout that identifies the location of the first character of string.

The function evaluates to F if the start of string is not identified at this position, even if string appears at another position in the record.

string

character

The character string to search for.

The search is case-sensitive. If there is a chance the case may be mixed, use the UPPER( ) function to convert all characters to uppercase.

Output

Logical. Returns T (true) if the specified string starts at the specified byte location within a record, and F (false) otherwise.

Examples

Basic examples

Given a record containing:

    Department: Marketing 
....|....|....|....|....|

Returns T:

TEST(5, "Department")

Returns F, because in the record, "Department" starts at the fifth byte position, not the sixth:

TEST(6, "Department")

Returns F, because the function is case-sensitive:

TEST(5, "DEPARTMENT")

Advanced examples

Isolating records that are page headings

Use TEST( ) to create a filter that isolates all records that start with "Page:":

SET FILTER TO TEST(1, "Page:")