Try OpenEdge Now
skip to main content
DataServer for Oracle
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 Oracle table does not support the ABL ROWID function (either through a PROGRESS_RECID column or an indexed NUMBER column with unique values), you can write the following code that explicitly requests the scrolling behavior that the ABL browse has by default:
/* Define a query named qCustomer for customer scrolling. */
DEFINE VARIABLE iRow as INTEGER NO-UNDO.

DEFINE QUERY qCustomer FOR customer FIELDS(address custnum name) SCROLLING.
DEFINE BROWSE b QUERY qCustomer DISPLAY custnum name address WITH 10 DOWN.
DEFINE BUTTON upd.

OPEN QUERY qCustomer FOR EACH customer.
ENABLE upd b WITH FRAME x.
ON CHOOSE OF upd DO:
  iRow = CURRENT-RESULT-ROW("qCustomer").
GET PREV qCustomer.
GET NEXT qCustomer EXCLUSIVE-LOCK.
IF CURRENT-RESULT-ROW("qCustomer") = 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.