Orders, indexes and key expressions
IndexKey([nOrdem]) -> cKeyChecks the index expression before building a search key.
Overview
The active order determines logical sequence and the expression used by DbSeek/MsSeek; its number is not universal across environments. IndexKey() returns the current expression as text; a missing order returns empty text, while a closed area can also raise an error. Search keys must follow component order, types and widths. DBMS physical indexes, RDD orders and business keys are related but not interchangeable. (Sources: refs. 1–2.)
Syntax
IndexKey([nOrdem]) -> cKeyCommented example
#Include "Protheus.ch"
User Function Ed563()
// Requires an open area with indexes; block not invoked.
Local bInspect := {|| IndexKey()}
ConOut(ValType(bInspect))
Return NilPrints B. Evaluation in the actual context yields the current order expression. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Inspect SIX/actual expression, restore the caller’s order and verify fields after searches. Changing order neither sorts an array nor automatically creates a new physical index.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.