This might help, I have it in my main DD subclass

Code:
    //This clears a child - but not the parents - thus meaning that when you create a new child
    //you don't have to refind all the parents.
    Procedure Clear_Retain_Parents
        // The standard Clear message also clears (non-Constrained) server DDOs.
        // This does not.
        Handle hoServer
        Handle[] hoServerList   // the object ids of all this DDO's servers
        Integer iCount iMax
        Get Data_Set_Server_Count to iMax
        Decrement iMax
        For iCount from 0 to iMax
            Get Data_Set_Server 0 to hoServer
            Move hoServer to hoServerList[iCount]
            Send Detach_Server hoServer
        Loop
        Send Clear
        For iCount from 0 to iMax
            Move hoServerList[iCount] to hoServer
            Send Attach_Server hoServer
        Loop
    End_Procedure