Deleted (return record status)

Top  Previous  Next

 

Deleted,VIRTUAL

The Deleted method returns Level:Benign (declared in ABERROR.INC) if the current record is active, i.e., if the record has not been identified in some way as deleted. In cases where the DeleteRecord method has been derived to say, flag deleted records rather than physically delete them, deriving a corresponding Deleted method allows these records to be identified.

The standard Deleted method always returns Level:Benign.

Return Data Type:     BYTE

Example:

PROGRAM

INCLUDE('ABFILE.INC')              !declare FileManager class

MAP  !program map

END

GlobalErrors ErrorClass            !declare GlobalErrors object

Access:Client CLASS(FileManager) . !derive Access:Client object

 

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.Deleted() = Level:Benign     !if record is not deleted

   IF Access;Client.DeleteRecord = Level:Benign !delete it

    POST(Event:CloseWindow)                     !if add succeeds, close down

   ELSE                                         !if add fails

    Access:Client.CancelAutoInc                 !restore the file

    CYCLE                                       !and start over

   END

  END

 END

!more code

See Also:     DeleteRecord