Consultor Eletrônico



Kbase P68155: How to update fields which are not submitted by the data target object ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/3/2005
Status: Unverified

GOAL:

How to update fields which are not submitted by the data target object ?

GOAL:

How to update fields which are not mapped in submitValidation of SDO ?

FIX:

The following example will update comments field in customer table based on the time modifications were done. You will have to override AssignDBRow in your SDO.

PROCEDURE AssignDBRow:
/*------------------------------------------------------------------------------
Purpose: Super Override AssignDBRow from src/adm2/query.p
Parameters:
Notes: Comments field must exit in the SDO
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER phRowObjUpd AS HANDLE NO-UNDO.

/* Code placed here will execute PRIOR to standard behavior. */
DEF VAR hRowObjUpd AS HANDLE.
DEF VAR hRowMod AS HANDLE.
DEF VAR hRowObjFld AS HANDLE.
DEF VAR cChangedFlds AS CHARACTER.

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

ASSIGN hRowObjFld = hRowObjUpd:BUFFER-FIELD('ChangedFields':U)
cChangedFlds = hRowObjFld:BUFFER-VALUE.

ASSIGN cChangedFlds = cChangedFlds + ',' + "Comments"
hRowObjFld:BUFFER-VALUE = cChangedFlds.
.

IF hRowMod:BUFFER-VALUE = "A":U
OR hRowMod:BUFFER-VALUE = "C":U
THEN
phRowObjUpd:BUFFER-FIELD( "Comments" ):BUFFER-VALUE =
"New Record added on "
+ STRING( TODAY ) + " at "
+ STRING( TIME, "HH:MM:SS" ).
ELSE
phRowObjUpd:BUFFER-FIELD( "Comments" ):BUFFER-VALUE =
"Record updated on "
+ STRING( TODAY ) + " at "
+ STRING( TIME, "HH:MM:SS" ).

RUN SUPER( INPUT phRowObjUpd).

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

END PROCEDURE.