Click or drag to resize

DbServer.OrderKeyAdd Method

Add a key to a custom built order.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.6
Syntax
 VIRTUAL METHOD OrderKeyAdd(
	uOrder AS USUAL := NIL,
	oFSIndex AS USUAL := NIL,
	uKeyValue AS USUAL := NIL
) AS USUAL
Request Example View Source

Parameters

uOrder (Optional)
Type: Usual
The name of the order or a number representing its position in the order list.  Using the order name is the preferred method since the position may be difficult to determine using multiple-order index files.  If omitted or NIL, the controlling order is assumed. Specifying an invalid order, such as one that is not custom built, will raise a runtime error.
oFSIndex (Optional)
Type: Usual
The name of an index file, including an optional drive and directory (no extension should be specified).  Use this argument with <uOrder> to remove ambiguity when there are two or more orders with the same name in different index files. If <oFSIndex> is not open by the current process, a runtime error is raised.
uKeyValue (Optional)
Type: Usual
A specific key value that you want to add for the current record.  The data type must match that of the order.  If not specified, the order's key expression is evaluated for the current record and added to the order.

Return Value

Type: Usual
TRUE if successful; otherwise FALSE.
Remarks
A custom built order is one that is not automatically maintained by the DBFCDX driver.  You can determine if an order is custom built using DBServer:OrderInfo(DBOI_CUSTOM, ...).  When you create such an order, it is initially empty. You must manually add and delete keys using DBServer:OrderKeyAdd() and DBServer:OrderKeyDel(). DBServer:OrderKeyAdd() evaluates the key expression (or <uKeyValue>, if specified), then adds the key for the current record to the order.  If the order has a for condition, the key will be added only if that condition is met, and then, only if it falls within the current scoping range.
Tip Tip
RDDs may allow you to add several keys for the same record with consecutive calls to DBServer:OrderKeyAdd().
DBServer:OrderKeyAdd() will fail if:
  • The record pointer is positioned on an invalid record (i.e., at DBServer:EOF)
  • The specified order is not custom built
  • The specified order does not exist
  • No order was specified and there is no controlling order
Tip Tip
From the standard RDDs only the DBFCDX RDD supports Custom Indexes. This RDD does NOT support the use of the <uKeyValue> parameter. It always uses the Key Expression to calculate the Key Values to insert.
Examples
This example creates a custom index and adds every fiftieth record to it:
X#
1oDBCust := Customer{}
2// Create custom built order that is initially empty
3oDBCust:SetOrderCondition(,,,,,,,,,,,,, TRUE)
4oDBCust:CreateIndex("last", "oDBCust:LastName")
5// Add every 50th record
6FOR n := 1 UPTO oDBCust:RecCount STEP 50
7oDBCust:GoTo(n)
8oDBCust:OrderKeyAdd()
9NEXT
See Also