Kbase P32922: ADM1 SmartViewer issues with non-Progress databases
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/5/2009 |
|
Status: Verified
SYMPTOM(s):
ADM1 SmartViewer issues with non-Progress databases
SmartViewer has Create-on-add attribute set to NO.
When calling add-record (using SmartPanel), the viewer is not cleared.
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
CAUSE:
The version 8 / ADM1 assumes that for DataServer
on-progress databases Create-on-add is always YES.
It does not handle create-on-add = NO for non-progress databases properly since it was not designed to do so.
FIX:
Modify the adm-add-record procedure in Tableio.i to clear the fields in the SmartViewer. Example:
...
IF adm-create-on-add = no THEN
DO:
IF DBTYPE(LDBNAME(BUFFER {&adm-first-enabled-table}))
EQ "PROGRESS":U THEN
DO:
/* Retrieve and display the template record initial values if
the record hasn't already been created and we're running
against a Progress DB. */
FIND {&adm-first-enabled-table} WHERE
RECID({&adm-first-enabled-table}) = adm-first-tmpl-recid
NO-LOCK.
&IF "{&adm-second-enabled-table}":U NE "":U &THEN
FIND {&adm-second-enabled-table} WHERE
RECID({&adm-second-enabled-table}) = adm-second-tmpl-recid
NO-LOCK.
&ENDIF
&IF "{&adm-third-enabled-table}":U NE "":U &THEN
FIND {&adm-third-enabled-table} WHERE
RECID({&adm-third-enabled-table}) = adm-third-tmpl-recid
NO-LOCK.
&ENDIF
DISPLAY {&UNLESS-HIDDEN} {&DISPLAYED-FIELDS}
WITH FRAME {&FRAME-NAME} NO-ERROR.
END.
/* Customization to make create-on-add = NO work better for
non-progress databases.
Note that initial values will not be set. */
ELSE DO:
DEFINE VARIABLE hObject AS HANDLE NO-UNDO.
hObject = FRAME {&FRAME-NAME}:FIRST-CHILD. /* field-group */
hObject = hObject:FIRST-CHILD. /* first field-level widget (fill-in etc.) */
DO WHILE VALID-HANDLE(hObject):
IF hObject:TYPE <> "LITERAL" AND
CAN-QUERY(hObject,"SCREEN-VALUE":U) THEN hObject:SCREEN-VALUE = "".
hObject = hObject:NEXT-SIBLING.
END.
END.
END. /* END code for Progress DB initial values. */
/* If the developer explicitly requested Create-On-Add or it's
not a Progress DB then do the CREATE. */
...
The actual creation of the records will work correctly even with create-on-add set to NO.