Click or drag to resize

DbServer.OrderInfo Method

X#
Return and optionally change information about orders and index files.

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD OrderInfo(
	kOrderInfoType,
	oFSIndex,
	uOrder,
	uOrdVal
) AS USUAL CLIPPER
Request Example View Source

Parameters

kOrderInfoType (Optional)
Type: Usual
Specifies the type of information. The constants are listed below. Note, however, that not all constants are supported for all RDDs.
oFSIndex (Optional)
Type: Usual
A string or filespec object that specifies the name of an index file, including an optional drive and directory (no extension should be specified). Use this argument with cOrder 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.
uOrder (Optional)
Type: Usual
The name of the order about which you want to obtain information or a number representing its position in the order list. (For single-order index files, the order name is the eight-letter index file name.) Using the order name is the preferred method since the position may be difficult to determine using multiple-order index files. Invalid values are ignored. If no index file or order is specified, the controlling order is assumed.
uOrdVal (Optional)
Type: Usual
If specified, this parameter is used to change the value of a setting. The data type (and whether uOrdVal can be specified), depends on the kInfoType constant and is documented in the Constants section below.

Return Value

Type: Usual
If uNewSetting is not specified, DBServer:OrderInfo() returns the current setting. If uNewSetting is specified, the previous setting is returned.
Remarks
Examples
This example uses DBOI_NAME to save the current controlling order. After changing to a new controlling order, it uses the saved value to restore the original order:
X#
1oDBCust := Customer{}
2oDBCust:SetIndex("name")
3oDBCust:SetIndex("serial")
4cOrder := oDBCust:OrderInfo(DBOI_NAME)        // name
5oDBCust:SetOrder("serial")
6? oDBCust:OrderInfo(DBOI_NAME)            // serial
7oDBCust:SetOrder(cOrder)
8? oDBCust:OrderInfo(DBOI_NAME)            // name
This example returns the default index file extension (using DBOI_INDEXEXT) for two different data servers:
X#
1oDBSales := Sales{}
2oDBCust := Customer{}
3? oDBSales:OrderInfo(DBOI_INDEXEXT)          // .CDX
4? oDBCust:OrderInfo(DBOI_INDEXEXT)           // .NTX
In this example, DBServer:OrderInfo(DBOI_INDEXEXT) checks for the existence of the CUSTOMER index file independent of the RDD associated with the data server:
X#
1oDBCust := Customer{}
2IF !File("customer" + oDBCust:OrderInfo(DBOI_INDEXEXT))
3oDBCust:CreateIndex("customer", "oDBCust:CustName")
4ENDIF
This example accesses the key expression of several orders from the same index file:
X#
1oDBCust := Customer{}
2oDBCust:SetOrder("serial")
3? oDBCust:OrderInfo(DBOI_EXPRESSION,, "name")
4// Result: key expression for name order
5? oDBCust:OrderInfo(DBOI_EXPRESSION,, "serial")
6// Result: key expression for serial order
In this example, ALL_CUST.MDX contains three orders named CUACCT, CUNAME, CUZIP. The DBOI_INDEXNAME constant is used to display the name of the index file using one of its orders:
X#
1oDBCust := Customer{}
2oDBCust:SetIndex("all_cust")
3? oDBCust:OrderInfo(DBOI_INDEXNAME,, "cuname")
4// Returns: all_cust
The following example searches for CUNAME in the order list:
X#
1oDBCust := Customer{}
2oDBCust:SetIndex("cuacct")
3oDBCust:SetIndex("cuname")
4oDBCust:SetIndex("cuzip")
5? oDBCust:OrderInfo(DBOI_NUMBER,, "cuname") // 2
This example retrieves the "for condition" from an order:
X#
1oDBCust := Customer{}
2oDBCust:SetOrderCondition("oDBCust:Acct > 'AZZZZZ'")
3oDBCust:CreateIndex("customer", "oDBCust:Acct")
4oDBCust:OrderInfo(DBOI_CONDITION,, "customer")
5// Returns: oDBCust:Acct > 'AZZZZZ'
See Also