cAliasTable alias.
AdvPL GuideNextNumero([cAlias],[nOrdem],[cNomeCpo],[lSomar],[cVar]) -> cNumeroObtains a candidate next sequential number.
The historical P8.11/P10 reference describes alias, index order, field, lSomar and cVar. True lSomar returns the next number; false returns cVar if absent or calculates the next if already present. An empty table yields 1 padded to field width. This contract does not document atomic reservation across users. The community sample queries SC7; this adaptation prepares a block without reading tables or creating orders. (Sources: refs. 1–2.)
NextNumero([cAlias],[nOrdem],[cNomeCpo],[lSomar],[cVar]) -> cNumerocAliasTable alias.
nOrdemIndex order matching the key.
cNomeCpoSequential field.
lSomarTrue calculates next; false checks cVar.
cVarCandidate value when lSomar is false.
Character number padded on the left according to the field.
#Include "Protheus.ch"
User Function Ed558()
// Prepare only; verify index and field in staging.
Local bNext := {|cAlias,nOrder,cField| NextNumero(cAlias,nOrder,cField,.T.)}
ConOut(ValType(bNext))
Return NilPrints B. The block is not evaluated and reserves no number. 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.