Consultor Eletrônico



Kbase P20839: What record should be returned by a FIND PREV or FIND NEXT i
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/22/2003
Status: Unverified

GOAL:

What record should be returned by a FIND PREV or FIND NEXT if there is no record in the buffer ?

FIX:

What record should be returned depends on where the cursor indicator on the buffer is located in the record set. The record set is the entire table, unless a record set was PRESELECTed for the current block.

1. If no FIND has been done for the buffer, FIND PREV and FIND NEXT act like FIND LAST and FIND FIRST respectively.
2. If the cursor-indicator is before the first record in the record set, FIND PREV will return no record, and FIND NEXT will act as FIND FIRST.
3. If the cursor-indicator is after the last record in the record set, FIND PREV will act as FIND LAST, and FIND NEXT will return no record.
4. If the cursor-indicator is somewhere in the record set, FIND PREV will find the record before the current position of the cursor indicator, and FIND NEXT will find the record after that position.

Examples, using a Sports database from which customer with cust-num 5 has been deleted:

1. No find statement.
- FIND PREV Customer. DISPLAY Cust-num. -> Returns cust-num = 84
- FIND NEXT Customer. DISPLAY Cust-num. -> Returns cust-num = 1
2. FIND Customer WHERE cust-num = 0 NO-ERROR. followed by:
- FIND PREV Customer. DISPLAY Cust-num. -> Returns nothing
- FIND NEXT Customer. DISPLAY Cust-num. -> Returns cust-num = 1
3. FIND Customer WHERE cust-num = 99999 NO-ERROR. followed by:
- FIND PREV Customer. DISPLAY Cust-num. -> Returns cust-num = 84
- FIND NEXT Customer. DISPLAY Cust-num. -> Returns nothing
4. FIND Customer WHERE cust-num = 5 NO-ERROR. followed by:
- FIND PREV Customer. DISPLAY Cust-num. -> Returns cust-num = 4
- FIND NEXT Customer. DISPLAY Cust-num. -> Returns cust-num = 6