Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

RECCOUNT()

RecCount()

Explains a legacy function superseded by LastRec.

RECCOUNT()AdvPL
01 · OVERVIEW

Overview

Current LastRec documentation marks RecCount and RecC obsolete. The contract concerns the last physical record, not a count of visible or undeleted rows. Do not use it as a business key or a filtered-query total. This uninvoked example shows the documented replacement. The documentation warns that pending changes may be flushed; avoid calling during a partially populated insert. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

RecCount()

Return value

Numeric in legacy use; check RDD behavior.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed612()
    // Requires an open real-table area; block not invoked.
    Local bLast := {|| LastRec()}
    ConOut(ValType(bLast))
Return Nil
Expected result

Only creates block B; no actual records counted. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Use COUNT(*) with correct filters for logical row counts; distinguish LastRec from Recno.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. LastRec. Substituição de RecCount/RecC e ressalvas de RDD. Accessed on 2026-10-27.
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