You are here: Functions > TEST()

TEST()

The TEST() function is only intended for use with single byte character sets (ASCII/EBCDIC) and is not designed for use with multi byte character sets (such as UNICODE) or non-English characters.

Note: For multi byte character sets and non-English characters, the alternative is to use the SUBSTRING() function, for example: SUB(LINE,1,6) = “Número” where LINE is a character field spanning the full record.

TEST() returns True, if a specified text string starts at a specified byte location within a record. Otherwise, TEST() returns False.

TEST() always compares the text string using the appropriate character set based on the field definitions. This is consistent with how the FIND() function also works.

TEST() is also automatically used when you create a filter in the “Create a Data Filter” window.

Function Format

TEST(N,C)

TEST() examines a record to see if a character string C starts at the specified position N. If so, TEST() returns True. Otherwise, it returns False, even if C appears at another position in the line.

Note: The parameters in TEST() are case-sensitive. Specifying “DEPT” does not find “Dept.” If there is a chance the case may be mixed, first use the UPPER() function to convert all characters to upper case.

If C is not a character expression, ensure that you surround it in quotes.

Examples

Given a record containing:

    Dept Name: Marketing

....|....1....|....2...

TEST(5,'Dept') = T

TEST(6,'Dept') = F

TEST(5,'DEPT') = F

To create a filter identifying page headings, specify the condition:

TEST(1,"Page:")