Kbase P185543: How to delete a row from a ProBindingSource bound to a ProDataSet
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/7/2011 |
|
Status: Unverified
GOAL:
How to delete a row from a ProBindingSource bound to a ProDataSet
GOAL:
How to delete a row from a the top level query of a ProDataSet bound to a ProBindingSource
GOAL:
Two methods to delete a record from a ProDataSet through a ProBindingSource
FACT(s) (Environment):
Windows
OpenEdge 10.2x
FIX:
The following examples both delete a row from the top-level temp-table in a ProDataSet bound to a ProBindingSource.
The first example is the most general method. After the desired row is deleted, the ProBindingSource is refreshed by reopening the query on the top-level temp-table. This example could be extended to delete multiple rows in a loop, reopening the query when all desired rows are deleted.
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
TEMP-TABLE ettCustomer:HANDLE:TRACKING-CHANGES = TRUE.
FIND ettCustomer WHERE ettCustomer.CustNum = INT(CustNum:Text).
DELETE ettCustomer.
hQuery = bindingSource1:Handle:TOP-NAV-QUERY. /* get the data source for the binding source */
hQuery:QUERY-OPEN().
TEMP-TABLE ettCustomer:HANDLE:TRACKING-CHANGES = FALSE.
The second example can only delete the current row. It does not require reopening the query, but as a consequence the ProBindingSource must be refreshed explicitly. Use the BindingSource:RefreshAll method rather than the Refresh method; Refresh acts on only one row, but multiple rows may need to be "moved up" in the ProBindingSource behind the deleted row.
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
TEMP-TABLE ettCustomer:HANDLE:TRACKING-CHANGES = TRUE.
hQuery = bindingSource1:Handle:TOP-NAV-QUERY.
hQuery:DELETE-RESULT-LIST-ENTRY().
TEMP-TABLE ettCustomer:HANDLE:TRACKING-CHANGES = FALSE.
bindingSource1:RefreshAll().