Kbase P122119: How can I delete items in a query after the OPEN QUERY but before the browse displays the records?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/7/2007 |
|
Status: Unverified
GOAL:
How can I delete items in a query after the OPEN QUERY but before the browse displays the records?
FACT(s) (Environment):
OpenEdge 10.x
FIX:
In order to filter a query attached to a browse widget when a where clause will not be enough to do the job you must define a dynamic query, filter the query and then attach that filtered query to the browse widget. The following code shows how to do this:
define variable hQuery as handle no-undo.
define variable hBuffer as handle no-undo.
create buffer hBuffer for table "Customer".
create query hQuery.
hQuery:set-buffers(hBuffer).
hQuery:query-prepare("for each customer no-lock").
hQuery:query-open.
hQuery:get-first().
do while hQuery:query-off-end = false:
if hBuffer:buffer-field("custNum"):buffer-value mod 2 <> 0 then
hQuery:delete-result-list-entry().
hQuery:get-next().
end.
hQuery:get-first().
assign browse {&browse-name}:query = hQuery.
browse {&browse-name}:refresh().