User Tools

Site Tools


deleterecord_delete_a_record_.htm
Navigation:  ABC Library Reference > FileManager > FileManager Methods >====== DeleteRecord (delete a record) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

DeleteRecord (<; query >),PROC,VIRTUAL

blk2blue.jpg

DeleteRecord Deletes a record from a file.
query A numeric constant, variable, EQUATE, or expression that determines whether DeleteRecord offers to confirm the delete with the end user. A value of one (1 or True) deletes only on confirmation from the end user; a value of zero (0 or False) delete without confirmation. If omitted, query defaults to 1.

The DeleteRecord method deletes a record from the file and returns Level:Benign (declared in ABERROR.INC). The primary purpose of this method is to permit the redefinition of “Delete” where appropriate. Possible uses include flagging a record as opposed to physically deleting it or logging delete transactions as they occur. The Query parameter is provided for compatibility with the Relation Manager's Delete method. RelationManager.Delete calls FileManager.DeleteRecord with Query = 1 in all cases except that where a delete has been requested without notifying the user. This allows derived versions of FileManager.DeleteRecord to physically delete a record after, say, the cancellation of autoincremented update.

The standard DeleteRecord method physically deletes the record and always returns Level:Benign (0).

Return Data Type:     BYTE

Example:

PROGRAM
INCLUDE('ABFILE.INC')              !declare FileManager class
MAP .                             !program map
GlobalErrors ErrorClass            !declare GlobalErrors object
Access:Client CLASS(FileManager)   !derive Access:Client object
             END
InsertWindow WINDOW('Add a new Client'),AT(,,159,73),IMM,SYSTEM,GRAY
             PROMPT('&amp;Name:'),AT(8,20),USE(?CLI:Name:Prompt)
             ENTRY(@s20),AT(61,20,84,10),USE(CLI:Name),MSG('Client Name'),REQ
             PROMPT('State Code:'),AT(8,34),USE(?CLI:StateCode:Prompt)
             ENTRY(@s2),AT(61,34,40,10),USE(CLI:StateCode),MSG('State Code')
             BUTTON('OK'),AT(12,53,45,14),USE(?OK),DEFAULT
            END
CODE
!program code
ACCEPT
 CASE FIELD()
 OF ?OK
  IF EVENT() = Event:Accepted                     !on OK button
   IF Access:Client.DeleteRecord() = Level:Benign !delete the new Client record
    POST(Event:CloseWindow)                       !if delete succeeds, close down
   ELSE                                           !if delete fails
    Access:Client.CancelAutoInc                   !restore the file
    CYCLE                                         !and start over
   END
  END
!more code

See Also:     Deleted

deleterecord_delete_a_record_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1