Kbase 13831: How to DELETE multiple records in a multi-selection browse
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How to DELETE multiple records in a multi-selection browse
This Kbase entry applies to version 7 of PROGRESS.
Under Version 8, a new browse method, DELETE-SELECTED-ROWS()
is available to perform this function. See related entry 15033
"V8 browse method DELETE-SELECTED-ROWS()".
This code example shows how to delete multiple records in a browse.
The browse must be defined as multi-selection. In this example,
cust-browse is a browse on the customer table of the sports database.
There is a button on the frame called btn_delete. When the user
chooses btn_delete, any rows highlighted (selected) in the browse
are deleted. The :REFRESH() method is then used to blank out the
deleted rows. (The empty space taken up by the blanked rows will not
be reclaimed until the browse query is reopened.)
DEF VAR i AS INTEGER.
DEF VAR x AS LOGICAL.
DEF VAR r AS RECID.
ON CHOOSE OF btn_delete IN FRAME f DO:
DO i = 1 TO cust-browse:NUM-SELECTED-ROWS:
x = cust-browse:FETCH-SELECTED-ROW(i).
IF x THEN DO:
r = RECID(customer).
FIND FIRST customer WHERE RECID(customer) = r
EXCLUSIVE-LOCK.
DELETE customer.
END.
END.
x = cust-browse:REFRESH().
END.
Progress Software Technical Support Note # 13831