RecordExists

Checks if a record exists

Syntax

LOADLIB "wh::system.whlib";

BOOLEAN FUNCTION RecordExists(RECORD rec)

Parameters

RECORD rec

Record to check

Return value

BOOLEAN

Returns TRUE if the record exists

Description

This function is useful to verify the existence of records, before any action is undertaken on these records. Many statements and functions (such as SELECT and FindFile) will return a non-existing record to indicate an error condition.

Examples

// prints 'Yes, it exists' or 'no, it does not exist', depending on
// whether a file width ID=1 exists
RECORD example1 := SELECT FROM files WHERE id=1;
IF ( RecordExists(example1) )
  Print ('Yes, it exists' );
ELSE
  Print ("No, it does not exist");