Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

Bof

Bof() --> lRet

Checks the workarea beginning-of-file flag.

BofAdvPL
01 · OVERVIEW

Overview

Bof checks the selected workarea or the alias used for evaluation. The official example runs DbGoTop followed by DbSkip(-1) to reach Bof: being on the first valid record alone does not establish this flag. Use it as a reverse-navigation boundary and account for empty tables and filters. The area must be open; do not alter or close a caller-owned alias merely to demonstrate it. (Refs. 1–2)

02 · SYNTAX

Syntax

Bof() --> lRet

Return value

Logical indicating the workarea beginning condition.

03 · PRACTICAL EXAMPLE

Commented example

// Diagnostic fragment: assumes caller has already opened SA1.
Local aArea := SA1->(GetArea())
SA1->(DbGoTop())
SA1->(DbSkip(-1))
ConOut(cValToChar(SA1->(Bof())))
// Restore the received position without closing SA1.
RestArea(aArea)
Expected result

On a navigable table, reproduces the official Bof condition. This diagnostic fragment requires an existing alias; it is not an opening routine. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Distinguish Bof from Eof and qualify the alias. For SQL queries, verify whether the RDD supports repositioning and backward navigation.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Bof. TOTVSTEC/TDN. Accessed on 2026-10-24.
  2. TOTVS. DBSkip. TOTVSTEC/TDN. Accessed on 2026-10-24.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha