BOF() Determine when beginning of file is encountered ------------------------------------------------------------------------------ Syntax BOF() --> lBoundary Returns BOF() returns true (.T.) after an attempt to SKIP backward beyond the first logical record in a database file; otherwise, it returns false (.F.). If there is no database file open in the current work area, BOF() returns false (.F.). If the current database file contains no records, BOF() returns true (.T.). Description 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 SKIP command. A simple usage example is a descending order record list with an ascending order index file. A more sophisticated example is a screen paging routine that pages forward or backward through the current database file based on the key the user presses. When the user attempts to page backward, you would use BOF() to test for a beginning of file condition before using the SKIP command to move the record pointer and repaint the screen. Once BOF() is set to true (.T.), it retains its value until there is another attempt to move the record pointer. 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). The SKIP command is the only record movement command that can set BOF() to true (.T.). Examples . This example demonstrates BOF() by attempting to move the record pointer before the first record: USE Sales NEW ? RECNO(), BOF() // Result: 1 .F. SKIP -1 ? RECNO(), BOF() // Result: 1 .T. . This example uses aliased expressions to query the value of BOF() in unselected work areas: USE Sales NEW USE Customer NEW USE Invoices NEW ? Sales->(BOF()), Customer->(BOF()) Files Library is CLIPPER.LIB.
See Also: EOF() SKIP
Pingback: C5_SKIP | Viva Clipper !