Kbase P721: ADM2. How to Reposition an added record correctly in a SmartDataBrowser
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/8/2007 |
|
Status: Verified
GOAL:
How to reposition to a new record added directly in a SmartDataBrowser?
GOAL:
When adding a record directly via a SmartDataBrowser, how to make the newly added record appear in the correct order?
FIX:
This solution entry provides a way to get around the standard behavior of ADM2 when adding a record to the data set.
Currently, when the Save button is pressed, the newly created record will end up at the end of the visualization of the query shown in the SmartDataBrowser (remember that this is the query on the RowObject Temp-Table), i.e. after the last record in the current data set.
Below is a description of how to get the newly added row into the correct spot in the visualization (the SmartDataBrowser).
Open up the source code of the SmartDataBrowser and add the following 2 lines to the Definitions section:
DEFINE VARIABLE rNewRecord AS CHARACTER NO-UNDO.
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
Then create an override procedure for updateRecord in the SmartDataBrowser and put the following piece of code after the RUN SUPER statement:
ASSIGN hDataSource = DYNAMIC-FUNCTION("getDataSource":U)
rNewRecord = DYNAMIC-FUNCTION("getRowident":U IN hDataSource).
DYNAMIC-FUNCTION("openQuery":U IN hDataSource).
DYNAMIC-FUNCTION("fetchRowIdent":U IN hDataSource, rNewRecord, "").