Consultor Eletrônico



Kbase P132382: How to get the handle of the current RowObject buffer from a viewer
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   6/16/2008
Status: Unverified

GOAL:

How to get the handle of the current RowObject buffer from a viewer

GOAL:

How to get the handle of the current RowObject buffer from a SmartDataViewer

GOAL:

How to get the handle of the current RowObject buffer from a SDV

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

From a SmartDataViewer there are two ways to get the handle to the RowObject buffer for the currently displayed records. Each are demonstrated below; however it should be noted that this should only be done for READ ONLY purposes and the default RowObject temp-table buffer should NEVER be directly modified from this perspective nor should it be navigated.
/* Method #1 - Gets RowObject buffer directly from SDO (DataSource) */
DEFINE VARIABLE hRowObject AS HANDLE NO-UNDO.
hRowObject = DYNAMIC-FUNCTION('getRowObject' IN
DYNAMIC-FUNCTION('getDataSource')).
/* Method #2 - Gets RowObject Table handle and creates a buffer for it, then repositions to current record */
DEFINE VARIABLE hRowObject AS HANDLE NO-UNDO.
DEFINE VARIABLE hRowObjBuff AS HANDLE NO-UNDO.
DEFINE VARIABLE cRowIdent AS CHARACTER NO-UNDO.
ASSIGN hRowObject = DYNAMIC-FUNCTION('getRowObjectTable' IN
DYNAMIC-FUNCTION('getDataSource'))
/* Call getRowIdent directly in the viewer, not the SDO. This
provides access to both the RowObject and DB Table ROWIDs. */
cRowIdent = DYNAMIC-FUNCTION('getRowIdent').
CREATE BUFFER hRowObjBuff FOR TABLE hRowObject.
hRowObjBuff:FIND-BY-ROWID(TO-ROWID(ENTRY(1,cRowIdent))).
*** CAUTION *** Never reposition the RowObject buffer that the SDO operates on. This WILL cause problems in the state mechanism upon which the ADM2 relies. *** CAUTION ***