Consultor Eletrônico



Kbase P27960: Unable to add records in SBO with multi page container appli
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   6/26/2003
Status: Unverified

FACT(s) (Environment):

Progress 9.1D

SYMPTOM(s):

Unable to delete records in SBO with multi page container application

Each viewer is mapped to one SDO included in SBO

All SDOs built against the same table.

** <file-name> already exists with <field/value...>. (132)

USER-INTERFACE-TRIGGER adm2/pupdsav.w (c:\toi\apps\progress\91d\dlc\gui\adm2\pupdsav.r) at line 3670
updateRecord adm2/datavis.p (c:\toi\apps\progress\91d\dlc\gui\adm2\datavis.r) at line 3981
--> showDataMessagesProcedure adm2/datavis.p (c:\toi\apps\progress\91d\dlc\gui\adm2\datavis.r) at line 3719

CAUSE:

Smart data objects which are data targets in SBO are trying to add the same record as their data source.

FIX:

DO not let data-targets SDOs to add records.

1. PROCEDURE assignDBRow:
/*------------------------------------------------------------------------------
Purpose: Super Override
Parameters:
Notes:
------------------------------------------------------------------------------*/

DEFINE INPUT PARAMETER phRowObjUpd AS HANDLE NO-UNDO.

/* Code placed here will execute PRIOR to standard behavior. */
DEF VAR vhSrc AS HANDLE NO-UNDO.
DEF VAR hRowObjUpd AS HANDLE NO-UNDO.
DEF VAR hRowMod AS HANDLE NO-UNDO.
DEF VAR vcKey AS CHARACTER NO-UNDO.

{get RowObjUpd hRowObjUpd}.
hRowMod = hRowObjUpd:BUFFER-FIELD('RowMod':U).

/* DO NOT permit ADD or COPY from Data-TARGETs */
IF hRowMod:BUFFER-VALUE = "A":U OR hRowMod:BUFFER-VALUE = "C":U THEN
DO:
vhSrc = dynamic-function( 'getDataSource' ).
IF VALID-HANDLE( vhSrc ) THEN DO:

/* reset this flag for UPDATE */
hRowMod:BUFFER-VALUE = ''.

/* get the value of the key field in the table */
/* replace fld_key with your field */
vcKey = hRowObjUpd:BUFFER-FIELD( 'fld_key' ):BUFFER-VALUE .

/* DB record must exist. It was created already by DataSource object */
/* adapt this FIND statement for your table */
FIND tbl600 WHERE fld_key = vcKey EXCLUSIVE-LOCK NO-ERROR.

END.

END.

RUN SUPER( INPUT phRowObjUpd).

/* Code placed here will execute AFTER standard behavior. */
/* DATA-Target updates the row from DATA-Source */
IF VALID-HANDLE( vhSrc ) THEN
RUN dataAvailable IN vhSrc ( INPUT "DIFFERENT" ).

END PROCEDURE.


2. Procedure reopenToRowid:
/*------------------------------------------------------------------------------
Purpose: Super Override
Parameters:
Notes:
------------------------------------------------------------------------------*/

DEFINE INPUT PARAMETER prRowObject AS ROWID NO-UNDO.

/* Code placed here will execute PRIOR to standard behavior. */
DEF VAR vhSrc AS HANDLE NO-UNDO.
vhSrc = dynamic-function( 'getDataSource' ).
/* no need to reposition on Data-Targets - RowObject may not be available */
IF VALID-HANDLE( vhSrc ) THEN RETURN.

RUN SUPER( INPUT prRowObject).

/* Code placed here will execute AFTER standard behavior. */

END PROCEDURE.