KEY_EXIST()

Syntax

Result_Flag as L = KEY_EXIST( Index_Tag as C, Key_Value as C )

Argument

Description

Index_Tag

The name of an index tag that may contain the Key_Value. The Index_Tag parameter can include a full drive and path specification. If you omit the drive and path, Alpha Five searches the current directory.

Key_Value

A string constant, character variable, or an expression that returns a character value.

Description

KEY_EXIST() returns .T. (TRUE) if Key_Value is found in index Index_Tag ; otherwise, it returns .F. (FALSE). This function is useful for checking if a record with a certain key value already exists in the primary table.

Note : If you want to define a Validation Field Rule to prevent the entry of a duplicate record, use KEY_UNIQUE(), not KEY_EXIST().

Supported By

Alpha Five Version 5 and Above

Examples

Assume that the following table is indexed on the NAME field, and the index is stored under the tag name "NAMEORD".

CUSTOMER

CUST_ID

NAME

C100

InSync

C101

ACE Software

C102

Friendlies

C103

Sunstar

C104

Progress Inc.

C105

Adventure Holidays

? key_exist("NAMEORD", "InSync")

= .T.

? key_exist("NAMEORD", "Alpha")

= .F.

See Also

Index Functions and Methods