aDestArray to modify.
AdvPL GuideAIns( <aDest>, <nPos> ) --> aRetInserts a Nil slot without growing the array.
AIns shifts elements forward and discards the last while keeping Len unchanged. To preserve the final element, grow the array before inserting and assign the new content into the created slot. The example reserves space with ASize. Insertion changes indexes, so refresh dependent selections afterward. (TOTVS, s.d., ref. 1)
AIns( <aDest>, <nPos> ) --> aRetaDestArray to modify.
nPosInsertion position starting at 1.
Array after insertion.
#Include "Protheus.ch"
User Function EdAins()
Local aItems := {"A", "C"}
// Reserve a slot to avoid discarding C.
ASize(aItems, Len(aItems) + 1)
AIns(aItems, 2)
aItems[2] := "B"
ConOut(aItems[3])
Return NilExpected array: {"A", "B", "C"}; output C. 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.