Click or drag to resize

Bof Function

Determine when beginning-of-file is encountered.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION Bof() AS LOGIC
View Source

Return Value

Type: Boolean
TRUE after an attempt to skip backward beyond the first logical record in a database file or if the database file contains no records; otherwise, FALSE.  If there is no database file open in the work area, BOF() returns TRUE.
Remarks
BOF() is a database function used to test for a boundary condition when you are moving the record pointer backward through a database file using the DBSkip() function.  An example is a screen paging routine that pages forward or backward through the database file based on a user key stroke.  When the user attempts to page backward, you would use BOF() to test for a beginning-of-file condition before using DBSkip() to move the record pointer and repaint the screen. By default, BOF() operates on the currently selected work area.  It can be made to operate on an unselected work area by specifying it within an aliased expression (see example below). DBSkip(), VODBSkip(), and the SKIP command are the only record movement operations that can set BOF() to TRUE.  Once BOF() is set to TRUE, it retains its value until there is another attempt to move the record pointer.
Examples
This example demonstrates BOF() by attempting to move the record pointer before the first record:
X#
USE sales NEW
QOut(RECNO(), BOF())                // Result: 1 FALSE
DBSkip(-1)
QOut(RECNO(), BOF())                // Result: 1 TRUE
This example uses aliased expressions to query the value of BOF() in unselected work areas:
X#
USE sales NEW
USE customer NEW
USE invoices NEW
QOut(sales->BOF(), customer->BOF())
See Also