xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Deleted()

Queries the Deleted flag of the current record

Syntax

Deleted() --> lIsDeleted

Return

The function returns .T. (true) if the current record is marked for deletion, otherwise .F. (false) is returned.

Description

The Deleted() function queries the Deleted flag of the current record. By default, it operates in the current work area. Use an aliased expression to retrieve the flag from a different work area.

The Deleted flag is set with function DbDelete() and can be removed with DbRecall(). Whether or not a record carries this flag is the task of the Deleted() function.

Note that records marked for deletion are not visible during database navigation when SET DELETED is set to ON.

Info

See also:DbRecall(), DbRecordInfo(), DELETE, PACK, RECALL, SET DELETED
Category: Database functions
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// This example uses Deleted() as part of an index expression so that
// all records carrying the deleted flag appear at the end of a database.
// This allows for an elegant technique of record recycling when new
// data must be stored. If a record is Deleted() its data is overwritten,
// otherwise a new record is appended.

   PROCEDURE Main

      USE Customer NEW
      INDEX ON IIf(Deleted(), Chr(255)+LastName, LastName+Chr(32) ) ;
            TO Cust01

      GO BOTTOM
      IF Deleted()
         nRecno := Recno()
         DbRecall()
      ELSE
         APPEND BLANK
         nRecno := Recno()
      ENDIF

      GOTO nRecno

      <assign new customer data here>

      USE
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe