Compartir a través de


BOF( ) Function

Determines whether the record pointer is positioned at the beginning of a table.

BOF([nWorkArea | cTableAlias])

Parameters

  • nWorkArea
    Specifies the work area number for a table open in another work area.

  • cTableAlias
    Specifies the table alias for a table open in another work area.

    If the table you want to test for a beginning-of-file condition is open in a work area other than the currently selected work area, use these optional arguments to specify the work area number or table alias for the table. If a table isn't open in the work area you specify, BOF( ) returns false (.F.).

Return Value

Logical

Remarks

Use BOF( ) to test for a beginning-of-file condition for a table. BOF( ) returns true (.T.) if you have tried to move the record pointer to a position before the first record in the table.

Example

The following example opens the customer table and lists the company name one page at a time, starting with the last record in the table. The listing continues until the beginning of the file is reached or until you choose Cancel.

CLOSE DATABASES
CLEAR
OPEN DATABASE (HOME() + "samples\data\testdata")
USE customer
GO BOTTOM
local recCtr, btnValue
recCtr = 0
btnValue = 1
DO WHILE btnValue = 1 AND NOT BOF()
 ? "Company : " + company
 recCtr = recCtr + 1
 if (recCtr % 20) = 0 then
  btnValue =MESSAGEBOX ("Click OK to continue, Cancel to quit.",33)
  clear
 endif
 Skip -1    && Move up one record
ENDDO
=MESSAGEBOX("Listing complete.",48)

See Also

Reference

EOF( ) Function

FEOF( ) Function

_FEOF( ) API Library Routine

Other Resources

Functions

Language Reference (Visual FoxPro)