Click or drag to resize

Functions.Bof Method (Usual)

Determine when beginning-of-file is encountered.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.16
Request Example View Source


Type: Usual
Specifies the work area name or number for a table from which the value must be retrieved.

Return Value

Type: Logic
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.
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, this function 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 or by calling the overload that accepts a workarea parameter (a workarea number or alias ). 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.
This example demonstrates BOF() by attempting to move the record pointer before the first record:
1USE sales NEW
2QOut(RECNO(), BOF())        // Result: 1 FALSE
4QOut(RECNO(), BOF())        // Result: 1 TRUE
This example uses aliased expressions to query the value of BOF() in unselected work areas:
1USE sales NEW
2USE customer NEW
3USE invoices NEW
4QOut(sales->BOF(), customer->BOF())
This example uses a parameter to the BOF() function to eveluate the value of BOF() in unselected work areas:
1USE sales NEW
2USE customer NEW
3USE invoices NEW
4QOut(BOF("sales"), BOF("customer"))
See Also