LastRec
LastRec() -> nRecordReads the last inserted record number in the current area.
Overview
This is neither a reliable active-record count nor business-key confirmation. The reference warns that pending actions may be flushed and raise Commit error; an unopened area causes an error. The example keeps the call in an unexecuted block so the caller controls context. (Sources: refs. 1–1.)
Syntax
LastRec() -> nRecordReturn value
Last record number according to the RDD.
Commented example
#Include "Protheus.ch"
User Function Ed504()
// Evaluate only with the appropriate area and no pending writes.
Local bLast := {|| LastRec()}
ConOut(ValType(bLast))
Return NilPrepares a block without querying the area or flushing pending actions. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Use an appropriate query for counts and distinguish logical, physical and deleted records.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.