Test for a unique index value

Command group Flag affected Reversible Execute on client Platform(s)
Finding data YES NO NO All

Syntax

Test for a unique index value on field-name

Description

This command tests the specified indexed field for a unique value. The flag is set if the current field value is a unique index value, and cleared if the value duplicates an existing index value. In a multi-user situation, no account is made of field values in records held by other work stations which are not yet updated to disk.

You use Test for a unique index value before storing a new value in a file. In the following example, the proposed new part number is tested against the existing file.

Example

# Insert account AC05 if it does not already exist
Set main file {fAccounts}
Prepare for insert
Calculate fAccounts.Code as 'AC05'
Test for a unique index value on fAccounts.Code
If flag true
  Update files
End If