Consultor Eletrônico



Kbase P68509: HOW TO handle Update and/or Add records with SDO validations
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   20/02/2004
Status: Unverified

GOAL:

HOW TO handle Update and/or Add records with SDO validations in Webspeed?

FACT(s) (Environment):

Webspeed 3.1x

FIX:

The following example works for mapped web objects having a Smart Data object as datasource:
/*
* the following code can be placed in findRecords procedure after
* standard behaviour
* get-field( 'h_trz' ) Add or Update button pressed
* h_cust_q is the handle to SDO datasource
* cRow is the last ROWID send to user(might be a hidden field in the HTML page)
*/
cTrz = get-field( 'h_trz' ).
cRow = get-field( 'h_rowid' ).
IF cTrz <> '' AND cTrz <> ? THEN
DO:
CASE cTrz :
WHEN "Update" THEN
DO:
DYNAMIC-FUNCTION('fetchRowIdent':U IN h_cust_q,
INPUT cRow, INPUT "" ) .
RUN assignFields.
END.
WHEN "Add" THEN
DO:
setAddMode(TRUE).
RUN assignFields.
RUN AddMessage( "New record added", "", "" ).
END.
END CASE.

ASSIGN h_rowid:SCREEN-VALUE IN FRAME {&FRAME-NAME} =
DYNAMIC-FUNCTION('getRowIdent':U IN h_cust_q).

END.