Kbase P114240: Not all records are retrieved from a QUERY when a FIND trigger is defined.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
SYMPTOM(s):
Not all records are retrieved by a query.
One of the tables used by the query has a FIND trigger.
FIND trigger may RETURN ERROR.
The WHERE clause specified in the QUERY contains a BY clause.
The BY clause cannot be satisfied by one of the existing indexes on the table with the FIND trigger.
The QUERY object is used by a BROWSE widget.
CAUSE:
This is a known issue currently under investigation by Development.
In order to experience the problem, you need all of the 5 conditions mentioned above, as shown by the following sample code:
DEFINE QUERY q FOR order SCROLLING.
DEFINE BUTTON bOpen LABEL "Open Query".
DEFINE BUTTON bCount LABEL "Count records".
/* 1) This is the BROWSE that you need to link to the query. */
DEFINE BROWSE br QUERY q
DISPLAY order.orderNum
order.custNum
WITH 10 DOWN.
FORM br SKIP(1) bOpen SPACE(2) bCount WITH FRAME f.
/* 2) This is the FIND trigger. */
ON FIND OF order
DO:
/* 3) Here, we may RETURN ERROR. */
IF order.ordernum MOD 2 = 1 THEN RETURN ERROR.
RETURN.
END.
ON CHOOSE OF bOpen IN FRAME f
DO:
/* 4 & 5) This is the query that cannot use an existing index. */
OPEN QUERY q FOR EACH order NO-LOCK BY order.shipDate.
RETURN.
END.
ON CHOOSE OF bCount IN FRAME f
DO:
DEFINE VARIABLE a AS INTEGER NO-UNDO.
GET FIRST q.
DO WHILE AVAILABLE order:
a = a + 1.
GET NEXT q.
END.
MESSAGE "Number of records from the query:" a
VIEW-AS ALERT-BOX INFO BUTTONS OK.
RETURN.
END.
ENABLE ALL WITH FRAME f.
WAIT-FOR GO OF FRAME f.
The number of records returned by clicking on button "Count records" is related to the number of records that have been displayed in the viewport of the browse.
Regarding the FIND trigger, the problem will occur with both a session FIND trigger, and with a database FIND trigger, or both.
FIX:
As of this writing, the only workaround is to avoid one of the 5 conditions that trigger the problem, or to use a FOR EACH on a BUFFER of the table to return the records.