cNameNew index name, different from the table in TOPCONN.
AdvPL GuideDBCreateIndex( <cName>, <cExprKey>, [bExprKey], [lUnique] ) --> NilCreates an index for the current table or view.
DBCreateIndex takes an index name and key expression with optional block and uniqueness. Documentation warns that an existing same-name index can be replaced and that the operation closes indexes, activates the new order and repositions records. The block should reflect the key value rather than the text containing its expression. The analyzed community file returns cIndice from its block; we do not reproduce that as an executable-key model. The fragment requires a new index and an owned RDD-compatible table. EDTRB identifies only an owned test table already open with the required schema and permissions; examples are not intended for standard tables. (TOTVS, n.d., ref. 1)
DBCreateIndex( <cName>, <cExprKey>, [bExprKey], [lUnique] ) --> NilcNameNew index name, different from the table in TOPCONN.
cExprKeyText key expression.
bExprKeyEquivalent executable expression.
lUniqueUnique-index option; check RDD semantics.
Nil; not a logical success indicator.
#Include "Protheus.ch"
User Function Ed329()
// ED_NEWIDX must be unused; owned EDTRB has field ED_COD.
If Select("EDTRB") > 0
EDTRB->(DBCreateIndex("ED_NEWIDX", "ED_COD", {|| ED_COD}, .F.))
EndIf
Return NilProposes index creation and test-context order changes; not a neutral lookup. 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.