Kbase P120928: How to blank a field in a smartDataBrowse when copying a record?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  05/12/2006 |
|
Status: Unverified
GOAL:
How to blank a field in a smartDataBrowse when copying a record?
GOAL:
How to update a field when copying a record in a smartDataBrowser
FIX:
Use a local user property to control custom code. For example in the local CopyRecord override in the SmartDataBrowser set a property to indicate a copy is being performed:
/* CopyRecord override */
RUN SUPER.
DYNAMIC-FUNCTION('setUserProperty':u IN TARGET-PROCEDURE,
INPUT "RecordCopy",
INPUT "Copy").
Then in a display fields override procedure in the smartDataBrowse, use the new property setting to control the custom copy code:
/* procedure displayFields */
RUN SUPER( INPUT pcColValues).
/* Code placed here will execute AFTER standard behavior. */
DEFINE VARIABLE cUserProp AS CHARACTER NO-UNDO.
cUserProp = DYNAMIC-FUNCTION('getUserProperty':u IN TARGET-PROCEDURE,
INPUT "RecordCopy").
IF cUserProp = "Copy" THEN
DO:
DEFINE VARIABLE h_browse AS HANDLE NO-UNDO.
DEFINE VARIABLE h_browsecol AS HANDLE NO-UNDO.
/* get the browse handle */
h_browse = DYNAMIC-FUNCTION('getbrowsehandle':U IN TARGET-PROCEDURE).
/* Blank column 2 - column 2 is the second column in the browse */
h_browsecol = h_browse:GET-BROWSE-COLUMN(2).
h_browsecol:SCREEN-VALUE = "".
DYNAMIC-FUNCTION('setUserProperty':u IN TARGET-PROCEDURE,
INPUT "RecordCopy",
INPUT "").
END.
The 'RecordCopy' property defined with a value of 'Copy' tells displayFields that a record copy is being performed. So the override code executes. Otherwise no additional action is taken.