Clear and Clear_All

You will use the Clear or Clear_All messages to clear DDOs. The Clear message will clear the DDO and all connected parent DDOs. If parent DDOs have a relates-to constraint between them the clear activity will be blocked by the constraint (i.e. the parent and any of its parents will not be cleared).

Clear_All unconditionally clears all DDOs in a structure.

After a Clear or Clear_All any attached DEOs will be notified of the change.

A Clear performs the following steps:

 

A Clear_All performs the following steps:

 

A clear operation may be programmed within a Web Object or Business Process object as follows:

Function ClearUser Returns integer

    Handle hoDD

    Move oCustomer_DD to hoDD

    Send Clear of hoDD

End_Function // SearchUser

The clear operation is often combined with other operations.

Function FindUser String sCustNo Returns RowId

    RowId  riRecId

    Handle hoDD

    Move oCustomer_DD to hoDD

    Send Clear of hoDD

    Move sCustNo to Customer.Customer_Number

    Send Find of hoDD EQ 1

    Get CurrentRowId of hoDD to riRecId

    Function_Return riRecId

End_Function // SearchUser

 

Clears and DEOs

The above sample shows how to use clears in batch processes. The Clear and Clear_All operations are built into Data Entry Objects allowing the user to direct the operation. A Clear (or Clear_All) is started when the user a presses a key (F5), clicks on a button or selects a menu option. This sends the message Request_Clear (or Request_Clear_All) to the DEO.  The DEO will then

 

Below is an example of a simplified DEO Request_Clear procedure. These are the types of methods and functionality built directly into DEOs.

// The DEO Clear Process

Procedure Request_Clear

    Handle hoDDO

    Boolean bChanged bError

    

    Get Server to hoDDO

    

    Get Should_Save of hoDDO to bChanged // are there changes?

    

    If bChanged begin

       Get Verify_Data_Loss to bError // do we really want to clear?

       If bError Procedure_Return     // user decided not to clear

    End    

    Send Clear of hoDDO // this will clear and notify all DEOs

End_Procedure

See Also

Find and Clear Operations in DDOs