bBlockPer-record block.
AdvPL GuideDBEval( <bBlock>, [bFirstCondition], [bSecondCondition], [nCount], [nRecno], [lRest] ) --> NilEvaluates a block for records in the selected scope.
DBEval executes a block over records under supplied conditions and limits. It returns Nil rather than a result list. The example counts at most three test-navigation records without writing fields. The caller must define scope and order/filter state; do not hide mass updates inside a supposedly read-only callback. EDTRB identifies only an owned test table already open with the required schema and permissions; examples are not intended for standard tables. (TOTVS, n.d., ref. 1)
DBEval( <bBlock>, [bFirstCondition], [bSecondCondition], [nCount], [nRecno], [lRest] ) --> NilbBlockPer-record block.
bFirstConditionFirst scope condition.
bSecondConditionSecond scope condition.
nCountRecord limit.
nRecnoSpecific scope record.
lRestRemaining-record processing option.
Nil; not a logical success indicator.
#Include "Protheus.ch"
User Function Ed331()
Local nCounted := 0
// Owned table only, without pending edits.
If Select("EDTRB") > 0
EDTRB->(DBGoTop())
EDTRB->(DBEval({|| nCounted++},,,3))
ConOut(cValToChar(nCounted))
EndIf
Return NilExpected count from 0 to 3 depending on data and filter; alias position changes. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.