Order Management

What is Order Management ?

There are some primary elements in Order Management :

Order :

An Order is a set that has two elements in it :

– an Order Name, which is a logical name that can be referenced, and
– an Order Expression which supplies the view of the data.

The Order Name provides logical access to the expression and the Order Expression provides a way of viewing the underlying data source. Data ordering can also be modified to ascending or descending sequence.

Order Name :

An Order Name is a symbolic name, that you use to manipulate an Order, like a file’s alias. The difference between an Order Name and the Order Number with which you would normally access indexes (Orders), is that the Order Name is stored in the index file. It is available each time you run the program, and is maintained by the system.

The Order Number is generated each time the Order is added to an Order List and may change from one program execution to another. This makes Order Name the preferred means of referencing Orders.

Order Expression :

Is any valid Clipper expression. This is an index expression such as :


This expression produces the ordered view of the data. The values derived from this expression are sorted, and it is the relationship of these values to one another that provides the actual ordering.

Order Number :

An Order Number is provided by the Order List.

An Order Number is only valid as long as the work area to which it belongs is open.

– Order Numbers provide one of the services performed by Order Names, allowing you to access a specific Order. In general, you should avoid accessing Orders by number.

– The ORDNUMBER() function returns the ordinal position of the specified <orderName> within the specified <orderList>.

Order Bag :

Unsorted collection of Orders. Each Order contains two elements : Order Name and Order Expression. Each Order Bag may have zero to n Orders. The maximum is determined by the RDD driver being used.

Order Bags are similar to multiple-index files in that there’s no guarantee of any specific order within the container or Bag. Within an Order Bag you can access specific Orders by referencing a particular Order Name. Order Bags have persistence between activations of the program.

Order List :

An Order List orders the collection of Orders that are associated with and active in the current work area. It provides an access to the Orders active within a given work area. Each work area has an Order List, and there is only one Order List per work area.

An Order List is created when a new work area is opened, and exists only as long as that work area is active. Once you close a work area, the Order List ceases to exist.

When you SET INDEX TO, the contents of the Order Bag are emptied into the Order List. At this point, the Orders in the Order List are active in the work area, where they will be updated as the data associated with the work area is modified.

You may access an Order in the list by its Order Number or by its Order Name. You should access an Order by its name rather than a hard-coded ordinal position. You can make any Order in the Order List the controlling Order by giving it focus, as explained below.

Order List Focus :

Order List Focus is, essentially, a pointer to the Order that is used to change the view of the data. It is synonymous with controlling Order or controlling index, and defines the active index order.

The SET ORDER TO command does not modify the Order List in any way. It does not clear the active indexes. It only changes the Order List Focus (the controlling order in the Order List).

The following list contains specific information regarding Order Bag usage and limitations with DBFNDX and DBFNTX index files :

Single-Order Bags :

With DBFNDX and DBFNTX you can explicitly assign the Order Name within the Order creation syntax. You can then use the Order Name in any command or function that accepts an Order Name (Tag) as a parameter.

Single-Order Bag with INDEX ON : Single-Order Bags may retain the Order Name between activations. During creation, DBFNTX stores an optionally supplied Order Name in the file’s header for subsequent use. Therefore, the Order Name is not necessarily the same as that of the file. By contrast, DBFNDX cannot store an Order Name since this would prevent dBASE from accessing the file. By default DBFNDX Orders inherit the name of their index file.

RDD Terms

Controlling Order:

The active Order (index) for a particular work area. Only one Order may control a work area at any time, and it controls the order in which the database is accessed during paging and searching.

Controlling Order :

The active Order (index) for a particular work area. Only one Order may control a work area at any time, and it controls the order in which the database is accessed during paging and searching.

 Identity :

A unique value guaranteed by the structure of the data file to reference a specific record in a database even if the record is empty. In the x-base file (.dbf), the identity is the record number; but it could be the value of a unique primary key or even the offset of an array in memory.

Identity Order :

Describes a database arranged by identity. In x-Base, this refers to the physical arrangement of the records in the database in the order in which they were entered (natural order).

Key Expression :

A valid Clipper expression that creates a key value from a single record.

Key Value :

A value that is based on value(s) contained within database fields, associated with a particular record in a database.

Keyed-Pair :

A pair consisting of a key value and an identity.

Lock List :

A list of the records that are currently locked in the work area.

Maintainable scoped Orders :

Scoped (filtered) Orders created using the FOR clause. The FOR condition is stored in the index header. Orders of this type are correctly updated using the expression to reflect record updates, deletions and additions.

Multiple-Order Bag :

An Order Bag that can contain any number of Orders; a multiple-Tag index. The (.cdx) and (.mdx) files are examples of multiple-Order Bags.

Non-maintainable/temporary Orders :

Orders created using the WHILE or NEXT clauses. These Orders are useful because they can be created quickly. However, the conditions in these clauses are not stored in the index header. Therefore, Orders of this type are not correctly updated to reflect record updates, deletions and additions. They are only for temporary use.

Order :

A named mechanism (index) that provides logical access to a database according to the keyed-pairs. This term encompasses both single indexes and the Tags in multiple-Tag indexes.

Orders are not, themselves, data files. They provide access to data that gives the appearance of an ordering of the data in a specific way. This ordering is defined by the relationships between keyed-pairs. An Order does not change the physical (the natural or entry) order of data in a database.

Order Bag :

A container that holds zero or more Orders. Normally a disk or memory file. A traditional index like (.ntx) is an Order Bag that holds only one Order. A multiple-Tag index (.mdx or .cdx) is an Order Bag that holds zero or more Orders.  Order Bags may be a memory or disk file.

Order List :

A list of all the Orders available to the database in the specified work area.

Record :

A record in the traditional database paradigm is a row of one or more related columns (fields) of data. In the expanded architecture of Clipper, a record could be data that does not exactly fit this definition.

A record is, in this expanded context, data associated with a single identity. In an x-Base data structure, this corresponds to a row (fields associated with a record number); in other data structures, this may not be the case.

Single-Order Bag :

An Order Bag that can contain only one Order. The (.ntx) and (.ndx) files are examples of single-Order Bags.

Tag :

An Order. A set of keyed-pairs that provides ordered access to the table based on a key value. Usually, an Order in a multiple-Order index (Order).

C5 RDD Functions

          MEMOSETSUPER() :

Set an RDD inheritance chain for the DBFMEMO database driver

         MEMOSETSUPER([<cSuperRDD>]) --> cOldSuperName


Return an array of the available Replaceable Database Drivers

RDDLIST([<nRDDType>]) --> aRDDList


Return the name of the RDD active in the current or specified work area

RDDNAME() --> cRDDName


Set or return the default RDD for the application

         RDDSETDEFAULT([<cNewDefaultRDD>]) --> cPreviousDefaultRDD