Consultor Eletrônico



Kbase 16169: FIND <record> OF <record> gives error 3166 ( unique find )
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
FIND <record> OF <record> gives error 3166 ( unique find )


If you write code similar to the following, you will encounter
error 3166:

DEF BUFFER b-cust FOR customer.
FIND FIRST b-cust.
DISPLAY b-cust.cust-num b-cust.name WITH FRAME f.

FIND b-cust OF b-cust. /* error 3166 here */
DISPLAY b-cust.cust-num b-cust.name WITH FRAME g.


The explanation of error 3166 is a worthwhile starting point in
explaining this behavior:

"FIND FIRST .... will find the first record satisfying the criteria
in the WHERE/OF/USING phrases. FIND ... without the FIRST keyword
is a unique find, and requires that there be ONLY ONE record that
satisfies the criteria given."

Although you'd expect that in the case above, PROGRESS would base
the comparison of customer records on the one already found, in fact
what is happening is that PROGRESS is matching each customer record
with itself. Thus, all customer records match the statement "FIND
customer OF customer".

To force the behavior most usually seen, include the keyword FIRST in
the second FIND:

FIND FIRST customer OF customer.

Note, however, that if this statement is used following a FIND that
has already delivered a customer record to the client, that first
customer record is ignored.

This is default behavior in a special case that is rarely encountered,
except in an occasional instance where arguments are passed to an
include file or to a .p that is compiled at runtime.

Progress Software Technical Support Note # 16169