| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > FileManager > FileManager Methods >====== DeleteRecord (delete a record) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[deleted return record status .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[destruct automatic destructor .htm|{{btn_next_n.gif|Next page}}]] | | || **DeleteRecord (**<;** **//query >//**),PROC,VIRTUAL** {{blk2blue.jpg|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('&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 return record status .htm|Deleted]]