cSomaCharacter sequence to increment.
AdvPL GuideSoma1( <cSoma>, [nPos], [lSomaLow], [lCompleteSUM] ) → cRetIncrements a character sequence, combining digits and letters when needed.
Soma1() produces the next value of a text sequence. It is useful when a character field must advance without direct numeric conversion, such as short item numbers, internal codes or counters shown on screen. The sequence can move from digits to letters, so it must not be handled as an ordinary number or used in arithmetic calculations.
Soma1( <cSoma>, [nPos], [lSomaLow], [lCompleteSUM] ) → cRetcSomaCharacter sequence to increment.
nPosPosition in the sequence to move.
lSomaLowWhether lowercase characters are used in the sequence.
lCompleteSUMControls full use of the characters available for sequential numbering; the consulted source reports .F. as the default.
Returns a string containing the next sequence value.
User Function ExSoma1Simple()
Local cSequence := "100"
cSequence := Soma1(cSequence)
MsgInfo(cSequence, "Next sequence")
ReturnThe character sequence "100" becomes "101".
User Function ExSoma1Alphanumeric()
Local cSequence := "9999"
cSequence := Soma1(cSequence)
MsgInfo(cSequence, "Alphanumeric sequence")
ReturnIn the reference example, "9999" becomes "999A". Validate the environment compatibility rule before using it as a business contract.
User Function ExSoma1AndTira1()
Local cSequence := "00"
Local nStep
For nStep := 1 To 150
cSequence := Soma1(cSequence)
Next nStep
cSequence := Tira1(cSequence)
MsgInfo(cSequence, "Sequence")
ReturnThe loop advances a text sequence; Tira1() steps back using the same format.
© 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