SET DELETED

SET DELETED

Toggle filtering of deleted records

Syntax

      SET DELETED on | OFF | <xlToggle>

Arguments

ON ignores deleted records.

OFF processes deleted records.

<xlToggle> is a logical expression that must be enclosed in parentheses. A value of true (.T.) is the same as ON, and a value of false (.F.) is the same as OFF.

Description

SET DELETED toggles automatic filtering of records marked for deletion in all work areas. When SET DELETED is ON, most commands ignore deleted records. If, however, you refer to a record by record number (GOTO or any command that supports the RECORD scope), the record is not ignored even if marked for deletion. Additionally, SET DELETED ON has no affect on INDEX or REINDEXing.

RECALL ALL honors SET DELETED and does not recall any records.

Notes

. Filtering deleted records in a single work area: To confine the filtering of deleted records to a particular work area, SELECT the work area, and then SET FILTER TO DELETED().

Examples

      .  This example illustrates the effect of using SET DELETED:

      USE Sales NEW
      ? LASTREC()                  // Result: 84
      //
      DELETE RECORD 4
      COUNT TO nCount
      ? nCount                     // Result: 84
      //
      SET DELETED ON
      COUNT TO nCount
      ? nCount                     // Result: 83

Seealso

DELETE, DELETED(), RECALL, SET FILTER

RECALL

Restore records marked for deletion

Syntax

      RECALL [<scope>] [WHILE <lCondition>]
             [FOR <lCondition>]

Arguments

<scope> is the portion of the current database file to RECALL. The default scope is the current record, or NEXT 1. If a condition is specified, the default scope becomes ALL.

WHILE <lCondition> specifies the set of records meeting the condition from the current record until the condition fails.

FOR <lCondition> specifies the conditional set of records to RECALL within the given scope.

Description

RECALL is a database command that restores records marked for deletion in the current work area. This is the inverse of the DELETE command. If DELETED is ON, RECALL can restore the current record or a specific record, if you specify a RECORD scope. Note that once you PACK a database file, all marked records have been physically removed from the file and cannot be recovered.

In a network environment, RECALLing the current record requires an RLOCK(). RECALLing several records requires an FLOCK() or EXCLUSIVE USE of the current database file. Refer to the “Network Programming” chapter for more information.

Examples

      .  This examples show the results of RECALL:

      USE Sales NEW
      //
      DELETE RECORD 4
      ? DELETED()               // Result: .T.
      //
      RECALL
      ? DELETED()               // Result: .F.

Seealso

DELETE, DELETED, FLOCK(), PACK, RLOCK(), SET DELETED

ZAP

ZAP

Remove all records from the current database file

Syntax

      ZAP

Arguments

(This command has no arguments)

Description

This command removes all of the records from the database in the current work area. This operation also updates any index file in use at the time of this operation. In addition, this command removes all items within an associated memo file. In a network enviroment, any file that is about to be ZAPped must be used exclusively.

Examples

      USE tests NEW INDEX tests
      ZAP
      USE

Compliance

Clipper

Seealso

DELETE, PACK, USE

PACK

PACK

Remove records marked for deletion from a database

Syntax

      PACK

Arguments

(This command has no arguments)

Description

This command removes records that were marked for deletion from the currently selected database. This command does not pack the contents of a memo field; those files must be packed via low-level fuctions.

All open index files will be automatically reindexed once PACK command has completed its operation. On completion, the record pointer is placed on the first record in the database.

Examples

      USE tests NEW INDEX tests
      DBGOTO( 10 )
      DELETE NEXT 10
      PACK
      USE

Compliance

Clipper

Seealso

DBEVAL(), DELETE, DELETED(), ZAP, RECALL

SP_DUPHANDLE

DUPHANDLE()

  Short:
  ------
  DUPHANDLE() Duplicate record finder with delete/copy options

  Returns:
  --------
  Nil

  Syntax:
  -------
  DUPHANDLE([aFields,aDesc],[aOpenIndexes])

  Description:
  ------------
  DUPHANDLE() is similiar to DUPLOOK(), but takes a
  different approach The user is asked to select fields (only
  Character fields are presented) to check for duplication. The
  fields selected are combined into an index key, and an index is
  created. The database is then scanned for duplicates. If a
  duplicate set is found, a Tbrowse/tag window is popped up, and
  the user is asked to tag records. This continues until all
  duplicate sets are found, or the user chooses to quit the
  process. The user is then allowed to Process the tagged
  duplicate records. There are 4 possible options:

         Delete all tagged records
         Delete all NOT tagged records
         Copy all tagged records
         Copy all NOT tagged records

  The options are not mutually exclusive. For instance,
  you could copy all tagged records to a history file, and then
  delete them.

  As with all SuperLib deletions, the PACKING is left
  to you.

  [aFields,aDesc] are optional arrays of fieldnames and
  field descriptions

  [aOpenIndexes] is an optional array of currently open
  index names. Clipper has no way to determine the names of
  currently open indexes and, since this function creates
  temporary indexes, the current indexes will be closed. Only by
  having a list [aOpenIndexes] can we re-open the indexes on exit.

  Examples:
  ---------

  USE customer

  duphandle()

  Warnings:
  ----------
  Closes all indexes.

  Source:
  -------
  S_DUPH.PRG

 

SP_DELREC

DELREC()

  Short:
  ------
  DELREC() Dialog box to delete/undelete current record

  Returns:
  --------
  <nStatus> => If deleted 1, if undeleted-1, if no
  action 0

  Syntax:
  -------
  DELREC()

  Description:
  ------------
  Asks for delete/undelete record with menu prompt and
  then deletes/undeletes or not If current record is not deleted,
  prompt will be

       DELETE  NOACTION

  If current record is deleted, prompt will be

       UNDELETE  NOACTION

  Examples:
  ---------
   IF nChoice = 6
       nDelstat := DELREC()
   ENDIF

  Source:
  -------
  S_DELET.PRG

 

C5_DELETE

 DELETE
 Mark records for deletion
------------------------------------------------------------------------------
 Syntax

     DELETE [<scope>] [WHILE <lCondition>]
        [FOR <lCondition>]

 Arguments

     <scope> is the portion of the current database file to DELETE.  If a
     scope is not specified, DELETE acts only on the current record.  If a
     conditional clause is specified, the default becomes ALL records.

     WHILE <lCondition> specifies the set of records meeting the
     condition from the current record until the condition fails.

     FOR <lCondition> specifies the conditional set of records to DELETE
     within the given scope.

 Description

     DELETE is a database command that tags records so they can be filtered
     with SET DELETED ON, queried with DELETED(), or physically removed from
     the database file with PACK.  In addition, display commands such as LIST
     and DISPLAY identify deleted records with an asterisk (*) character.
     Once records are deleted, you can reinstate them by using RECALL.  If
     you want to remove all records from a database file, use ZAP instead of
     DELETE ALL and PACK.

     Any deleted record can be recalled as long as the PACK or ZAP command
     has not been issued.  Once the PACK or ZAP command has been issued, the
     deleted data cannot be retrieved.

     In a network environment, DELETE requires the current record be locked
     with RLOCK() if you are deleting a single record.  If you are deleting
     several records, the current database file must be locked with FLOCK()
     or USEed EXCLUSIVEly.  Refer to the "Network Programming" chapter in the
     Programming and Utilities Guide for more information.

 Notes

     .  DELETE with SET DELETED ON: If the current record is deleted
        with SET DELETED ON, it will be visible until the record pointer is
        moved.

 Examples

     .  This example demonstrates use of the FOR clause to mark a set
        of records for deletion:

        USE Sales INDEX Salesman NEW
        DELETE ALL FOR Inactive

 Files   Library is CLIPPER.LIB.

See Also: DBEVAL() DELETED() FLOCK() PACK RECALL RLOCK()