Kbase P48792: Deleting a record from a smartDataBrowse also removes the fi
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  28/10/2003 |
|
Status: Unverified
FACT(s) (Environment):
Dynamics 2.0A
SYMPTOM(s):
Deleting a record from a smartDataBrowse also removes the first browse record.
If a parent SDO has a child SDO, and both SDO's have corresponding SmartDatabrowsers, deleting a record from the child browse and re-opening the parent SDO query can remove another record from the child browse display.
The record re-appears when the browse is refreshed.
FIX:
You may want to re-open the parent SDO because you have changed a value in the parent SDO record in the child SDO delete validation procedures. So, instead of re-opening the query do the following:
1. Perform the parent SDO update in the 'deleteEndTransValidate' procedure of the child SDO. So that after the child record is deleted the parent record is updated in the transaction.
2. In the 'deletePostTransValidate' procedure of the child SDO, get the handle of the datasource (parent SDO) and then the handle of it's target SDB (parent SDB). Then run a procedure (described in 3 below) in the custom super procedure of the SDB using the parent SDB handle.
3. In the custom super procedure of the parent SDB browse create a procedure that gets the handle of its source SDO then runs 'refreshRow' in the parent SDO handle.
This refreshes the parent browse without losing the child record in its browse and without needing to reopen the query.
As an example, if the SDO's were Order and Orderline, the deletePostTransValidate' procedure of the orderline SDO could be:
DEFINE VARIABLE h_OrderSDO AS HANDLE NO-UNDO.
DEFINE VARIABLE h_OrderlineSDO AS HANDLE NO-UNDO.
DEFINE VARIABLE h_OrderSDB AS HANDLE NO-UNDO.
DEFINE VARIABLE cType AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTargets AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
{get datasource h_OrderlineSDO}.
cType = DYNAMIC-FUNCTION('getObjectType':U IN h_OrderlineSDO).
{get datasource h_OrderSDO}.
cType = DYNAMIC-FUNCTION('getObjectType':U IN h_OrderSDO).
cTargets = DYNAMIC-FUNCTION('getdatatarget':U IN h_OrderSDO).
DO i = 1 TO NUM-ENTRIES(cTargets):
h_OrderSDB = WIDGET-HANDLE(ENTRY(i,cTargets)).
IF DYNAMIC-FUNCTION('getObjectType':U IN h_OrderSDB) = 'SmartDataBrowser' THEN
LEAVE.
END.
RUN browseRefresh IN h_OrderSDB.
Then In the custom super procedure of the order smartDataBrowse create a procedure that gets the handle of its source SDO then runs 'refreshRow' in the Order SDO handle.
So, you should create a procedure called browseRefresh in the Order SDB custom super procedure with the following code:
DEFINE VARIABLE h_DataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE cRowIdent AS CHARACTER NO-UNDO.
{get datasource h_DataSource}.
cRowIdent = DYNAMIC-FUNCTION('getRowIdent':U IN h_DataSource) NO-ERROR.
RUN refreshrow IN h_DataSource.