| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > RelationManager > RelationManager Methods >====== Delete (delete record subject to referential constraints) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[close close a file and any related files .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[getnbfiles returns number of children .htm|{{btn_next_n.gif|Next page}}]] | | || **Delete( **[ //confirm //] **), VIRTUAL** {{blk2blue.jpg|blk2blue.jpg}} | **Delete** | Deletes the record from the primary file subject to any specified referential integrity constraints. | | //Confirm// | An integer constant, variable, EQUATE, or expression that indicates whether 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) deletes without confirmation. If omitted, //confirm //defaults to one (1). | The **Delete **method deletes the current record from the primary file (see //Me//) applying any specified referential integrity constraints, then returns a value indicating its success or failure. The deletes are done within a transaction frame if the Init method's //uselogout //parameter is set to one (1). **Implementation:** Delete constraints are specified by the AddRelation method. If the constraint is RI:Restrict, the method deletes the current record only if there are no related child records. If the constraint is RI:Cascade, the method also deletes any related child records. If the constraint is RI:None, the method unconditionally deletes only the primary file record. If the constraint is RI:Clear, the method unconditionally deletes the primary file record, and clears the linking field values in any related child records. The Delete method calls the primary file FileManager.Throw method to confirm the delete with the end user. **Return Data Type:**     BYTE **Example:** **DeleteCustomer PROCEDURE** ** CODE** ** Relate:Customer.Open               !Open Customer & related files** ** IF NOT GlobalErrors.Throw(Msg:ConfirmDelete) !have user confirm delete** **  LOOP                              !allow retry if delete fails** **   IF Relate:Customer.Delete()      !delete subject to constraints** **    IF NOT GlobalErrors.Throw(Msg:RetryDelete) !if del fails, offer to try again** **     CYCLE                          !if user accepts, try again** **    END                             ! otherwise, fall thru** **   END                              !if del succeeds or user declines** **  UNTIL 1                           ! fall out of loop** ** END** **See Also:**     [[addrelation set a file relationship .htm|AddRelation]], [[init initialize the relationmanager object .htm|Init]]