cFieldExisting field name in the alias.
AdvPL GuideFieldBlock( cField ) --> bRetCreates a block for reading or assigning a field.
A FieldBlock block reads when evaluated without a value and assigns when supplied a value. Not every Eval is harmless reading. A missing field can allow block creation and fail only on evaluation. This GitHub adaptation checks field and record position, evaluates without a write value and keeps EDTRB context during creation and evaluation. It reports value type rather than registration data. EDTRB is an already-open owned test alias; ED_COD, when used, is a length-10 character field in the teaching schema. (TOTVS, n.d., ref. 1)
FieldBlock( cField ) --> bRetcFieldExisting field name in the alias.
Field-access block; definition errors can return Nil.
#Include "Protheus.ch"
User Function Ed383()
Local bRead
Local xValue
If Select("EDTRB") > 0
If EDTRB->(FieldPos("ED_COD")) > 0 .And. !EDTRB->(Eof())
bRead := EDTRB->(FieldBlock("ED_COD"))
// No second argument: do not assign the field.
xValue := EDTRB->(Eval(bRead))
ConOut(ValType(xValue))
EndIf
EndIf
Return NilWith prepared schema/record, expected type C without assignment. 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.