Consultor Eletrônico



Kbase P101961: 4GL/ABL: Error (91) referencing a field of an unavailable table record.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/10/2008
Status: Verified

SYMPTOM(s):

4GL/ABL: Error (91) referencing a field of an unavailable table record.

** No <file-name> record is available. (91)

Running Code similar to:
DEFINE QUERY qCustomer FOR Customer.
OPEN QUERY qCustomer PRESELECT EACH Customer WHERE Customer.CustNum = 9999 NO-LOCK.
MESSAGE Customer.Name
VIEW-AS ALERT-BOX INFO BUTTONS OK.

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

CAUSE:

The MESSAGE statement is referencing a field to be extracted from Customer buffer which does not contain a record.

FIX:

Make sure that there is a record in the buffer before referencing any of its its fields. The GET statement accesses the desired record and the AVAILABLE function checks whether the buffer actually contains a record:

DEFINE QUERY qCustomer FOR Customer.
OPEN QUERY qCustomer PRESELECT EACH Customer WHERE Customer.CustNum = 9 NO-LOCK.
/* Access the desired record */
GET FIRST qCustomer.
/* Check whether the record buffer contains a record */
IF AVAILABLE(Customer) THEN
/* process the record data as desired */
MESSAGE Customer.Name
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE
/* There is no record in the buffer */
/* Time to take alternative action. */
MESSAGE "No record is available..."
VIEW-AS ALERT-BOX INFO BUTTONS OK.