table.DELETE Function

Syntax

V Delete()

Description

Mark the current record for deletion.

Discussion

The <TBL>.DELETE() method deletes the current record in the table referenced by <TBL>. The table must be in change mode before the record can be deleted. Use the <TBL>.CHANGE_BEGIN() method to put the table into change mode. The record is only deleted after the <TBL>.CHANGE_END() method is executed. You can check the delete status of a record using the <TBL>.IS_DELETED() method. To remove all records from a table, use <TBL>.ZAP(). To remove a range of records, use <TBL>.DELETE_RANGE(). Note : When you delete a record, Alpha Anywhere automatically fetches the next record.

Example 

This script deletes the current record.

dim tbl as P
tbl = table.current()
tbl.change_begin()
tbl.delete()
tbl.change_end(.T.)

This script deletes the first 10 records. Note that there is no need to fetch the next record.

dim tbl as P
dim i as N
i = 0
tbl = table.open("cust_copy")
while i < 10
    tbl.change_begin(.t.)
    tbl.delete()
    tbl.change_end(.t.)
    i = i + 1
end while
tbl.close()

See Also