ORDCREATE()

Create an Order in an Order Bag

Syntax

ORDCREATE(<cOrderBagName>,[<cOrderName>], <cExpKey>,
[<bExpKey>], [<lUnique>]) --> NIL

Arguments

<cOrderBagName> is the name of a disk file containing one or more Orders. You may specify <cOrderBagName> as the filename with or without the pathname or extension. If you do not include the extension as part of <cOrderBagName> HARBOUR uses the default extension of the current RDD.

<cOrderName> is the name of the Order to be created.

Note: Although both <cOrderBagName> and <cOrderName> are both optional, at least one of them must be specified.

<cExpKey> is an expression that returns the key value to place in the Order for each record in the current work area. <cExpKey> can represent a character, date, logical, or numeric data type. The maximum length of the index key expression is determined by the database driver.

<bExpKey> is a code block that evaluates to a key value that is placed in the Order for each record in the current work area. If you do not supply <bExpKey>, it is macro-compiled from <cExpKey>.

<lUnique> is an optional logical value that specifies whether a unique Order is to be created. If <lUnique> is omitted, the current global _SET_UNIQUE setting is used.

Returns

ORDCREATE() always returns NIL.

Description

ORDCREATE() is an Order management function that creates an Order in the current work area. It works like DBCREATEINDEX() except that it lets you create Orders in RDDs that recognize multiple-Order Bags. ORDCREATE() supersedes the DBCREATEINDEX() function because of this capability, and is the preferred function.

The active RDD determines the Order capacity of an Order Bag. The default DBFNTX and the DBFNDX drivers only support single-Order Bags, while other RDDs may support multiple-Order Bags (e.g., the DBFCDX and DBFMDX drivers).

In RDDs that support production or structural indexes (e.g., DBFCDX, DBFMDX), if you specify a Tag but do not specify an Order Bag, the Tag is created and added to the index. If no production or structural index exists, it will be created and the Tag will be added to it. When using RDDs that support multiple Order Bags, you must explicitly SET ORDER (or ORDSETFOCUS()) to the desired controlling Order. If you do not specify a controlling Order, the data file will be viewed in natural Order.

If does not exist, it is created in accordance with the RDD in the current or specified work area.

If exists and the RDD specifies that Order Bags can only contain a single Order, is erased and the new Order is added to the Order List in the current or specified work area.

If exists and the RDD specifies that Order Bags can contain multiple Tags, is created if it does not already exist, otherwise is replaced in and the Order is added to the Order List in the current or specified work area.

Examples

The following example demonstrates ORDCREATE() with the DBFNDX
driver:
USE Customer VIA "DBFNDX" NEW
ORDCREATE( "CuAcct",, "Customer->Acct" )
The following example demonstrates ORDCREATE() with the
default DBFNTX driver:
USE Customer VIA "DBFNTX" NEW
ORDCREATE( "CuAcct", "CuAcct", "Customer->Acct", ;
{|| Customer->Acct } )
The following example demonstrates ORDCREATE() with the FoxPro
driver, DBFCDX:
USE Customer VIA "DBFCDX" NEW
ORDCREATE( "Customer", "CuAcct", "Customer->Acct" )
This example creates the Order "CuAcct" and adds it to the
production index (Order Bag) "Customer". The production index , will
be created if it doesn't exist:
USE Customer VIA "DBFMDX" NEW
ORDCREATE( , "CuAcct", "Customer->Acct" )

Tests




Status

Started

Compliance


See Also