DELETED( ) Function

Returns a logical value that indicates whether the current record is marked for deletion.

DELETED([cTableAlias | nWorkArea])

Return Values

Logical

Parameters

  • cTableAlias | nWorkArea
    You can check the status of the current record in a table open in another work area by specifying the work area number with nWorkArea or the table alias with cTableAlias. If a table isn't open in the work area you specify, DELETED( ) returns false.

    If you omit cTableAlias and nWorkArea, the deleted status is returned for the current record in the current work area.

Remarks

If the record is marked for deletion, DELETED( ) returns true (.T.); otherwise, DELETED( ) returns false (.F.).

Records can be marked for deletion with DELETE and DELETE – SQL, and they can be unmarked with RECALL.

Rushmore optimizes queries that test the deleted status of records if the table is indexed on DELETED( ).

For information on using Rushmore to optimize queries, see SET OPTIMIZE and Using Rushmore to Speed Data Access.

Example

The following example opens the customer table in the testdata database. DELETE – SQL is used to mark all records for deletion where the country field contains USA. DELETED( ) is used to display all the records marked for deletion. RECALL ALL is used to unmark all the records marked for deletion.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE customer  && Opens Customer table

DELETE FROM customer WHERE country = 'USA'  && Mark for deletion
CLEAR
LIST FIELDS company, country FOR DELETED( ) && List marked records
RECALL ALL  && Unmark all records marked for deletion

See Also

DELETE | DELETE – SQL | PACK | RECALL | SET DELETED