aliasValidation alias.
AdvPL GuideExistCpo( alias, expressao, [indice] ) --> lRetValidates reference existence.
ExistCpo approves an existing reference and rejects a missing one. Supply the expression without branch as documented; do not automatically reuse a DBSeek key. Omitted index uses the last selected index according to this source. Rejection can display help, so this is not a generic silent lookup. The GitHub source demonstrates SA1 code/store calls; this proposal uses a parameterized callback without querying real records. Prevalidation alone does not solve concurrency or transactional uniqueness. (TOTVS, n.d., ref. 1)
ExistCpo( alias, expressao, [indice] ) --> lRetaliasValidation alias.
expressaoKey without branch.
indiceOrder matching the expression.
True when its rule is satisfied; false on rejection.
#Include "Protheus.ch"
User Function Ed374()
Local bValidate := {|cAlias,cKey,nOrder| ExistCpo(cAlias,cKey,nOrder)}
// Branch-free key and matching order; do not evaluate here.
Return NilBlock prepared without lookup; return meaning depends on each function’s rule. 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.