Kbase P60438: Query Preselect and On Find Override not retrieving correct record in a browse
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  24/12/2004 |
|
Status: Unverified
FACT(s) (Environment):
Progress 9.1D
OpenEdge 10.0A
SYMPTOM(s):
Query Preselect and On Find Override not retrieving correct record in a browse
Query Preselect and Browse behavior
CHANGE:
Example code that gives the problem.
/* Display a browse on the customer table and display information about
selected records */
def query cust-qry for customer.
def browse cust-browse query cust-qry display customer.custnum
customer.name format "x(20)"
with 17 down title "Customer Browse".
def frame f1 cust-browse with side-labels at row 2 column 2.
def frame f2 with 1 columns 2 down side-labels at row 2 column 45.
/* Create a find trigger to limit the records */
on find of customer OVERRIDE do:
if not (customer.country = "USA" and customer.state = "MN") then
return error.
end.
on value-changed of cust-browse
do:
display customer.custnum customer.name customer.state customer.country
with frame f2.
end.
open query cust-qry preselect each customer.
/* If the following phrase is enabled and the find trigger override is
removed it will work properly */
/* where customer.country = "USA" AND customer.state = "MN".*/
enable cust-browse with frame f1.
wait-for window-close of current-window.
on find of customer revert.
CAUSE:
Bug# 20031222-016
FIX:
If you want to use the FIND trigger, to implement security. If this is a requirement, this means that when we have a result list on a query, we would have to modify the result list, so that the browse will work properly. The reason for this is that the FIND trigger fires when the browse tries to load the records for display, NOT when the result list is generated. The query's result list will contain all records that match the criteria given in the query, not the criteria of the FIND trigger.
If you want to use the FIND trigger, the only workaround for this is to use a query that does not build a result list. In this specific case, we are using PRESELECT to build the result list.