Consultor Eletrônico



Kbase P34956: How to use the buffer object FIND-FIRST method?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/06/2005
Status: Unverified

GOAL:

How to use the buffer object FIND-FIRST method?

GOAL:

How to find a record when its table and the WHERE clause is known only at run time.

GOAL:

How to supress error 565 when calling FIND-FIRST method on a buffer handle?

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x

FIX:

This sample works against sports2k:
/* these two variables are the run time variable*/
DEFINE VARIABLE ctablename AS CHARACTER INITIAL 'customer' NO-UNDO.
DEFINE VARIABLE pcwhereClause AS CHARACTER INITIAL "where custnum = 24" NO-UNDO.

DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE myrowid AS ROWID NO-UNDO.
CREATE BUFFER hBuffer FOR TABLE ctablename. DEFINE VARIABLE lok as LOGICAL NO-UNDO.lok = hBuffer:FIND-FIRST( pcwhereClause , NO-LOCK) NO-ERROR.


IF lok THEN DO:
myrowid = hBuffer:ROWID.
MESSAGE "Record found."
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
ELSE
MESSAGE "Record not found."
VIEW-AS ALERT-BOX INFO BUTTONS OK.