Try OpenEdge Now
skip to main content
DataServer for Microsoft SQL Server
Initial Programming Considerations : ABL issues : DEFINE BROWSE statement
 

DEFINE BROWSE statement

The DEFINE BROWSE statement relies on a unique record identifier for forward and backward scrolling. If your MS SQL Server data source table does not support the OpenEdge ROWID function (through either a PROGRESS_RECID column or an indexed column with unique values, defined as bigint in OpenEdge Release 10.1B and later or as integer in Release 10.A or earlier), you can write code that explicitly requests the default OpenEdge browse scrolling behavior, similar to this:
DEFINE VARIABLE iRow AS INTEGER NO-UNDO.
DEFINE QUERY q FOR customer FIELDS (custnum name address) SCROLLING NO-LOCK.
DEFINE BROWSE b QUERY q DISPLAY custnum name address WITH 10 DOWN.
DEFINE BUTTON upd.

OPEN QUERY q FOR EACH customer NO-LOCK.
ENABLE upd b WITH FRAME x.
ON CHOOSE OF upd DO:
  iRow = CURRENT-RESULT-ROW("q").
GET PREV q.
GET NEXT q EXCLUSIVE-LOCK.
IF CURRENT-RESULT-ROW("q") EQ iRow THEN
UPDATE customer.address WITH FRAME z VIEW-AS DIALOG-BOX.
/* else, indicate that an error occurred: the record was deleted in
the meantime. */
  DISPLAY customer.address WITH BROWSE b.
END.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.