Syntax
OrdCreate( cOrderBagName, [cOrderName], cExpKey, bExpKey, [lUnique] ) --> NILArguments
cOrderBagName
Bag file. cOrderName Optional order name. cExpKey Key text.
bExpKey
Key block. lUnique Optional unique flag.
Return value
NIL.
Description
OrdCreate() evaluates bExpKey for records in the current work area, stores the resulting order in cOrderBagName, and optionally assigns cOrderName. cExpKey is retained as metadata and lUnique controls duplicate keys. The area remains open; its pointer is used while keys are generated.
Notes
The work area must be open and writable. Invalid expressions, blocks, bags or duplicate unique keys raise an error. OrdCreate() creates an order in a bag; DbCreateIndex() is the lower-level single-index form.
Example
PROCEDURE Main()
DbUseArea( .T., , "people.dbf", "People" )
OrdCreate( "people.ntx", "NAME", "NAME", {|| FIELD->NAME } )
QOut( "Order created: " + OrdName( 1 ) )
DbCloseArea()
RETURNOutput